This project is archived and is in readonly mode.

#6439 ✓committed
rubymaverick

ActiveRecord::Base.scopes includes all scopes defined in all subclasses

Reported by rubymaverick | February 16th, 2011 @ 02:49 AM | in 3.1

ActiveRecord::Base.scopes which is defined as a class_attribute in NamedScope is shared by all classes that inherit from ActiveRecord::Base. ActiveRecord::Base#scope does not dup the scopes class_attribute hash for every class. I'm guessing having every model share every scope is not the intended functionality, but I may be missing something obvious. Attached is a patch for with a test and the code that makes that test pass.

Comments and changes to this ticket

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