Pagination obviously doesn't works on Array, but ActiveRecord::Relation set.
You have to rewrite your color selector using 'standard de facto' approach:
class Car < ActiveRecord::Base
scope :colored, lambda { |color| where(:color => color) }
end
Then just call:
Car.colored(%w{red blue}).page ... etc
On 05.06.2011, at 20:11, danimashu wrote:
> Hello, I have a model like this:
>
> class Car < ActiveRecord::Base
> def color(c)
> where("color = ?",c)
> end
> end
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.