Closed sumskyi closed 3 months ago
I ended up with this:
class Controller
expose(:pagination) { find_users.first }
expose(:users) { find_users.last }
private def find_users
@find_users ||= pagy(User.all)
end
end
Workaround from @dillonhafer is fine.
@sumskyi I would've suggested something similar as well... glad that worked out. I don't think it's be a good idea to change expose's signature to accommodate the rare case that it'd be used in this way.
I'd like to have the possibility to expose multiple things once, like:
expose(:pagination, :users) { pagy(User.all) }
https://github.com/ddnexus/pagy, i.e.
@pagy, @records = pagy(Product.all)
returns an array :)