Overriding default_scope in Rails

后端 未结 4 1239
北恋
北恋 2020-12-13 07:09

In my Post.rb model, I have default_scope :conditions => {:deleted => \'false\'}

But if I try to run Post.find(:all, :conditions => \"del

4条回答
  •  情深已故
    2020-12-13 07:39

    This one was somehow left hidden :)

    Just use Post.unscoped.where(:deleted => true), if you're using Rails 3

    Credit goes to José Valim for this.

提交回复
热议问题