There is any way to use impressionist gem with will paginate? I try to use impressionist to a will_paginate
collection like this:
posts = Post.all.paginate(:page => params[:page])
impressionist(posts)
But It raises this error:
WillPaginate::Collection is not impressionable!
There is any way to use impressionist method directly on view?
The collection generated by
will_paginate
is not impressionable means exactly you are reading, it's class doesn't have any calls tois_impressionable
, as your model should have. If it doesn't, add it like this:Then, if you can't call it in the collection, why not call it in each record instead? Try like this:
Maybe it's not the most elegant solution, but it will get the work done. As of doing this in your view, I wouldn't advise it. Impressionist creates a database record, which would slow your view rendering. It will be better to do it in the model or controller layers.