Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

PATCH: ActiveRecord::Base.subclasses is not publicly accessible

#3115

"subclasses" class method is not accessible on ActiveRecord::Base class, but it is on other classes like ActionController::Base.

Knowing the subclasses of AR::Base is pretty useful for every day usage. Currently, I have to resort to the "send hack" to access this information (not considering scanning the ObjectSpace an option).

ActiveRecord::Base.subclasses returns a new Array each time it is called, so should not be possible to affect AR sane behavior by manipulating the array returned.

Patch is attached.

Reported by EmmanuelOga · August 28th, 2009 @ 05:18 PM

State: stale
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. EmmanuelOga
    EmmanuelOga
    • Title changed from ActiveRecord::Base.subclasses is not publicly accessible to PATCH: ActiveRecord::Base.subclasses is not publicly accessible

    August 28th, 2009 @ 05:35 PM

  2. Craig Buchek
    Craig Buchek

    +1 -- I've found this very useful.

    Patch still applies cleanly as of 2010-04-12 / 3c456a869abeb0a639518180214db5ead428aedf.

    Was unable to test ActiveRecord, due to my configuration.

    April 13th, 2010 @ 02:00 AM

  3. Jeff Barczewski
    Jeff Barczewski

    +1 It is useful to have access to this for plugins. I would like to see this added as well.

    April 19th, 2010 @ 05:31 PM

  4. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open
    • Importance changed from to

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 2nd, 2011 @ 04:43 PM

  5. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:43 PM