[Rails] Re: Applying default conditions to a model's find, find_by_*

2009-02-27 Thread ericindc
Not at this point, so I'd prefer to come up with a solution using 2.2.2. On Feb 27, 12:46 am, Craig Demyanovich cdemyanov...@gmail.com wrote: If you can move to Rails 2.3, which is currently in release candidate testing, you could use default

[Rails] Re: Applying default conditions to a model's find, find_by_*

2009-02-27 Thread Maurício Linhares
At your model, override the find method: class SomeModel ActiveRecord::Base class self def find(*args) with_scope( :conditions = {:property = 'value'} ) do super(*args) end end end end - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) |

[Rails] Re: Applying default conditions to a model's find, find_by_*

2009-02-27 Thread ericindc
I originally used a with_scope, but that doesn't play nicely with will_paginate. On Feb 27, 3:14 pm, Maurício Linhares mauricio.linha...@gmail.com wrote: At your model, override the find method: class SomeModel ActiveRecord::Base   class self     def find(*args)       with_scope(

[Rails] Re: Applying default conditions to a model's find, find_by_*

2009-02-26 Thread Craig Demyanovich
If you can move to Rails 2.3, which is currently in release candidate testing, you could use default scoping: http://ryandaigle.com/articles/2008/11/18/what-s-new-in-edge-rails-default-scoping Regards, Craig --~--~-~--~~~---~--~~ You received this message because