mislav/will_paginate

Can there be better error encapsulation if the infered collection is nil as a result of being a hash (particularly a nested one)?

Heizenburg opened this issue · 1 comments

collection ||= infer_collection_from_controller

Hi, the inferring behavior is relatively simple:

<%= will_paginate %>

If the above runs in the context of a "users" controller, for instance, and no paginated collection was explicitly passed to will_paginate, the collection will try to be read from the @users variable.

This mechanism isn't great and doesn't cover a lot of the cases. I'm not proud that I've build the inferring behavior in the first place. I would suggest not using it and not relying on it, and instead doing:

<%= will_paginate @users %>