Hi,
We''re exploring the new world of named scopes (hooray) and wondered
about some functionality.
If I have for example
named_scope :foo, :conditions => {:bar => true, :quux => 2}
which obviously creates a Model.foo method, would it be possible to
automatically generate a method Model#foo? which told you whether an
instance of that model was a member of the Model.foo collection?
The idea is that the named scope would let you do things like
model Article
named_scope :published, :conditions => { :some => :conditions }
end
@article = Article.published.first # for the entire model
@article.published? # for any given article
Is there any reason this wouldn''t be possible?>
Thanks,
Gareth
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---