Bug #17555
closedsubclasses method in 2.7.2 is buggy
Description
I am finding that the subclasses method in 2.7.2 gives a faulty result, containing only one of the many subclasses in my system. Example, running 2.7.0 first, then 2.7.2:
mark@MacBook-Pro-2 my-project-rails5 % rvm use ruby-2.7.0
Using /Users/mark/.rvm/gems/ruby-2.7.0
mark@MacBook-Pro-2 my-project-rails5 % rails c
Warning: the running version of Bundler (2.1.2) is older than the version that created the lockfile (2.2.3). We suggest you to upgrade to the version that created the lockfile by running gem install bundler:2.2.3
.
Running via Spring preloader in process 14701
Loading development environment (Rails 6.0.3.4)
2.7.0 :001 > ApplicationRecord.subclasses
=> [User (call 'User.connection' to establish a connection), AeEntry (call 'AeEntry.connection' to establish a connection), AeSystem (call 'AeSystem.connection' to establish a connection), Criticality (call 'Criticality.connection' to establish a connection), Diagnosis (call 'Diagnosis.connection' to establish a connection), Dosage (call 'Dosage.connection' to establish a connection), Event (call 'Event.connection' to establish a connection), EventNote (call 'EventNote.connection' to establish a connection), EventNoteType (call 'EventNoteType.connection' to establish a connection), EventSeries (call 'EventSeries.connection' to establish a connection), Medication (call 'Medication.connection' to establish a connection), MedicationSubstance (call 'MedicationSubstance.connection' to establish a connection), Outcome (call 'Outcome.connection' to establish a connection), Patient (call 'Patient.connection' to establish a connection), Practice (call 'Practice.connection' to establish a connection), Prescriber (call 'Prescriber.connection' to establish a connection), Protocol (call 'Protocol.connection' to establish a connection), ProtocolEntry (call 'ProtocolEntry.connection' to establish a connection), ResponseCodeForEvent (call 'ResponseCodeForEvent.connection' to establish a connection), Result (call 'Result.connection' to establish a connection), ResultType (call 'ResultType.connection' to establish a connection), Specialty (call 'Specialty.connection' to establish a connection)]
2.7.0 :002 > quit
mark@MacBook-Pro-2 my-project-rails5 % ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
mark@MacBook-Pro-2 my-project-rails5 % rvm use ruby-2.7.2
Using /Users/mark/.rvm/gems/ruby-2.7.2
mark@MacBook-Pro-2 my-project-rails5 % rails c
Warning: the running version of Bundler (2.1.4) is older than the version that created the lockfile (2.2.3). We suggest you to upgrade to the version that created the lockfile by running gem install bundler:2.2.3
.
Running via Spring preloader in process 14897
Loading development environment (Rails 6.0.3.4)
2.7.2 :001 > ApplicationRecord.subclasses
=> [User (call 'User.connection' to establish a connection)]
2.7.2 :002 >
mark@MacBook-Pro-2 my-project-rails5 % ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
mark@MacBook-Pro-2 my-project-rails5 % cat app/models/diagnosis.rb
frozen_string_literal: true¶
class Diagnosis < ApplicationRecord
end
Updated by RedOne (Mark Morgan) over 3 years ago
- ruby -v set to ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
mark@MacBook-Pro-2 my-project-rails5 % rvm use ruby-2.7.0
Using /Users/mark/.rvm/gems/ruby-2.7.0
mark@MacBook-Pro-2 my-project-rails5 % rails c
Warning: the running version of Bundler (2.1.2) is older than the version that created the lockfile (2.2.3). We suggest you to upgrade to the version that created the lockfile by running gem install bundler:2.2.3
.
Running via Spring preloader in process 14701
Loading development environment (Rails 6.0.3.4)
2.7.0 :001 > ApplicationRecord.subclasses
=> [User (call 'User.connection' to establish a connection), AeEntry (call 'AeEntry.connection' to establish a connection), AeSystem (call 'AeSystem.connection' to establish a connection), Criticality (call 'Criticality.connection' to establish a connection), Diagnosis (call 'Diagnosis.connection' to establish a connection), Dosage (call 'Dosage.connection' to establish a connection), Event (call 'Event.connection' to establish a connection), EventNote (call 'EventNote.connection' to establish a connection), EventNoteType (call 'EventNoteType.connection' to establish a connection), EventSeries (call 'EventSeries.connection' to establish a connection), Medication (call 'Medication.connection' to establish a connection), MedicationSubstance (call 'MedicationSubstance.connection' to establish a connection), Outcome (call 'Outcome.connection' to establish a connection), Patient (call 'Patient.connection' to establish a connection), Practice (call 'Practice.connection' to establish a connection), Prescriber (call 'Prescriber.connection' to establish a connection), Protocol (call 'Protocol.connection' to establish a connection), ProtocolEntry (call 'ProtocolEntry.connection' to establish a connection), ResponseCodeForEvent (call 'ResponseCodeForEvent.connection' to establish a connection), Result (call 'Result.connection' to establish a connection), ResultType (call 'ResultType.connection' to establish a connection), Specialty (call 'Specialty.connection' to establish a connection)]
2.7.0 :002 > quit
mark@MacBook-Pro-2 my-project-rails5 % ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
mark@MacBook-Pro-2 my-project-rails5 % rvm use ruby-2.7.2
Using /Users/mark/.rvm/gems/ruby-2.7.2
mark@MacBook-Pro-2 my-project-rails5 % rails c
Warning: the running version of Bundler (2.1.4) is older than the version that created the lockfile (2.2.3). We suggest you to upgrade to the version that created the lockfile by running gem install bundler:2.2.3
.
Running via Spring preloader in process 14897
Loading development environment (Rails 6.0.3.4)
2.7.2 :001 > ApplicationRecord.subclasses
=> [User (call 'User.connection' to establish a connection)]
2.7.2 :002 >
mark@MacBook-Pro-2 my-project-rails5 % ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
mark@MacBook-Pro-2 my-project-rails5 % cat app/models/diagnosis.rb
frozen_string_literal: true¶
class Diagnosis < ApplicationRecord
end
Updated by byroot (Jean Boussier) over 3 years ago
subclasses is provided by rails not Ruby.
Also it's not a bug, simply a known behavior. Rails's subclass
method can only list loaded classes, you are testing in autoload mode.
Updated by marcandre (Marc-Andre Lafortune) over 3 years ago
- Status changed from Open to Rejected