This project is archived and is in readonly mode.

#3115 ✓stale
EmmanuelOga

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

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

"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.

Comments and changes to this ticket

  • EmmanuelOga

    EmmanuelOga August 28th, 2009 @ 05:35 PM

    • Title changed from “ActiveRecord::Base.subclasses is not publicly accessible” to “PATCH: ActiveRecord::Base.subclasses is not publicly accessible”
  • Craig Buchek

    Craig Buchek April 13th, 2010 @ 02:00 AM

    +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.

  • Jeff Barczewski

    Jeff Barczewski April 19th, 2010 @ 05:31 PM

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

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:43 PM

    • 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.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:43 PM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages