@animals = @animals.select{|animal| animal.temporary_home == home_params }
@animals = .... additional filters
@pagy, @animals = pagy(@animals)
I'm new to pagy and I keep running into this error when I attempt to apply filtering to the data
17:23:03 web.1 | NoMethodError (undefined method `offset' for []:Array):
If I do not apply filtering, the following works:
@pagy, @animals = pagy(Animal.all)
Is it possible to use Pagy with filtered data?
So the problem is pagy actually works on
ActiveRecord::Collectionsince@animalsis an array the methods forActiveRecord::Collectionwont be present on it.Pagyincludes another extention (?) to work with arrays. check outhttps://ddnexus.github.io/pagy/extras/array.html#gsc.tab=0