This project is archived and is in readonly mode.

#414 ✓resolved
Tarmo Tänav

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

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=""></a>

People watching this ticket