Page break with finder_sql defined by association in a rail model

I have a piece of code like:

class Foo < ActiveRecord::Base
  #Some Code
  has_many :bars, finder_sql: proc{ "Valid SQL" }
  #Some more code
end

Now, when I call foo.bar (where foo is an instance of Foo), how can I paginate the results since the row is extracted from finder_sql? Is there a quick and easy way to do this?

+4
source share
1 answer

Give kaminari . This is a gem that helps with pagination and works very well. Not sure if it works with find_sql and associations, but worth a try. I know this works with regions.

0
source

All Articles