Adrien Nom wrote: > Hi, > > I would like to return a combination of named scopes in a named > scope : > > For example, I have a named scope filter and I want to add a named > scope eval_filters like > > Product.eval_filters(['x','y','z']) is equivalent to > Product.filter('x').filter('y').filter('z')
>From http://edgerails.info/articles/what-s-new-in-edge-rails/2010/02/23/the-skinny-on-scopes-formerly-named-scope/, you could do something like scope :eval_filters, lambda { |fltr| fltr.inject(scoped) { |combined_scope, flt| combined_scope.where("id = ?", flt) }} Thanks Raja -- Posted via http://www.ruby-forum.com/. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.