Another reason why I wont use default scopes again
There always comes a time comes when you don't want that default_scope to apply.
For such times I have been using the unscoped method. It has worked great till the day I saw this happening:
user = User.find(1) user.features Select * from features where feature.userid = 1 order by name user.features.unscoped Select * from features
What!! Ihe last statement, calling unscoped droped the where clause of the association.
Thats not cool. I ended up deciding to avoid default_scope in the future and for the time being I am doing:
Feature.unscoped do user.features end Select * from features where feature.userid = 1









