Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

will_paginate returns a relation now, so result.replace [blah] doesn't work anymore #253

inspire22 opened this Issue Jul 24, 2012 · 1 comment


None yet
2 participants

Any tips? This used to work but now it returns a relation so we don't have direct access to the collection object anymore.

I'm using a workaround where I call
nws = nws.all if ActiveRecord::Relation === nws

to get my collection object instead, but it was still a pretty big gotcha for me at least.

My use case: I do some combining/simplification of results after getting the paged rows, then replace the array with my modified one.


mislav commented Jan 10, 2013

Your workaround with all is the right way of doing this. You can also use to_a.

@mislav mislav closed this Jan 10, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment