This project is archived and is in readonly mode.
named_scope that composes other named_scopes
-
Ryan Bates
That's a pretty cool idea. It's similar to ticket #57 :through option for "named_scope".
I'm wondering if the :include option might be a good spot for this. Currently it's just used to manage associations, but what if you could include named scopes? This has the side benefit that you can use it in any "find" call as well as the named scope. It also would allow you to include named scopes through associations. For example:
class Category has_many :products named_scope :visible, :conditions => { :hidden => false } end class Product belongs_to :category named_scope :released, :conditions => "products.released_at IS NOT NULL" named_scope :visible, :include => [:released, {:category => :visible}] endOkay, probably just a crazy idea that would be ridiculously complicated to implement. But a fun thought none-the-less.
-
josh
- Assigned user set to Pratik
- Tag set to activerecord, enhancement, named_scope
-
Pratik
- State changed from new to wontfix
Closing until we have a patch. Also looks like a duplicate of #57 :through option for "named_scope" which has a patch.
Thanks.