Is there a way to filter all finder methods on a model so that all
records where the expired column=1 are not returned??
Thanks
Chris
Is there a way to filter all finder methods on a model so that all
records where the expired column=1 are not returned??
Thanks
Chris
Hey Chris,
Check out acts_as_paranoid [1]. It’ll probably do exactly what you
need, though you may need to modify your db just a tad. If you’re
working with a legacy db and the plugin doesn’t work for you, you can
just go ahead and adapt the plugin code to work with your db.
Pat
Chris wrote:
Is there a way to filter all finder methods on a model so that all
records where the expired column=1 are not returned??Thanks
Chris
Model.find(:all, :conditions => ‘expired_column = 1’
Then put this in a method like:
def Model.find_all_not_expired
Model.find(:all, :conditions => ‘expired_column = 1’)
end
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs