In my Post.rb model, I have default_scope :conditions => {:deleted => 'false'}
But if I try to run Post.find(:all, :conditions => "deleted='false'")
, it won't return anything. It's as if the default_scope takes precedence over everything.
I want it so that when I do Post.find()
it doesn't return deleted posts, but I'd also like to be able to access them if I need to. What needs to be changed in either my query or my Rails model?
Thanks.
default_scope
does take precedence over everything. I wrote an answer usingnamed_scope
to your previous question that I think would be applicable here as well: #2073697 – Chretien