default named_scope


I was wondering, is there a way to add a default named scope for a model?

I would like all Model queries to have an "active = 1" condition.

And optionally another named_scope where "active = 1 or active = 0".

Cheers, M.

I'm not sure I follow. Isn't that essentially what named_scope is for?

named_scope :active, :conditions => {:active => 1} named_scope :inactive, :conditions => {:active => 0}

Then anytime you want the active ones use: @my_models =

Or for inactive ones use: @my_models = MyModel.inactive

Or are you talking about overiding the behavior or find(:all) to default to filtering for active? It just seems more logical and simpler to use name_scope the way it was intended to be used.

What am I missing here?

Marcelo Barbudas wrote: