Chris
2006-Feb-22 07:21 UTC
[Rails] Filtering all find methods so expired records not returned
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 -- Posted via http://www.ruby-forum.com/.
Pat Maddox
2006-Feb-22 07:28 UTC
[Rails] Filtering all find methods so expired records not returned
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 [1] http://ar-paranoid.rubyforge.org/ On 2/22/06, Chris <evilgeenius@gmail.com> 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 > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
joey__
2006-Feb-22 09:24 UTC
[Rails] Re: Filtering all find methods so expired records not return
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 > ChrisModel.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 Joey http://www.feedreed.com -- Posted via http://www.ruby-forum.com/.