This project is archived and is in readonly mode.
Named scopes misbehave when named with a string
Reported by Tarmo Tänav | June 13th, 2008 @ 09:51 PM | in 2.1.1
Named scopes are stored in a hash "scopes" but the key used for the hash is taken directly from the name parameter, it can be a string or a symbol. But if a string is used then the scope works when called directly on the model class, but if composed on another scope the other scope is ignored.
The reason most likely has something to do with method_missing always receiving the method name as a symbol and not knowing the scope was stored with a string as its key.
Since there is no good reason why scopes should need to be stored with both string and symbol keys the obvious fix is to just convert the scope name to a symbol when it is defined.
Comments and changes to this ticket
-
Jeremy Kemper June 16th, 2008 @ 12:27 PM
- Milestone set to 2.1.1
- State changed from new to open
- Assigned user set to Jeremy Kemper
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>