Ruby on Rails Tuesday, September 28, 2010

On Sep 28, 9:38 am, Adrien Coquio <adrien.coq...@gmail.com> wrote:

> That works fine when I give some filters to the function but when
> filters is an empty array, I lost the previous name scope.
> Example :
>
> Category.first.products.eval_filters("public_domain") -----> OK !
> Category.first.products.eval_filters(nil) ------> return Product.all
>
> When I use the debugger in the function, self is always an instance of
> the class Product.
>
yeah, that will happen. Best thing is to call a trivial scope eg
scoped({})

Fred

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment