P
P
pup_pupets2016-05-18 21:25:14
Ruby on Rails
pup_pupets, 2016-05-18 21:25:14

How to apply will_paginate to an existing SERP?

I have a complex and large dataset with a bunch of different conditions. Model.where(....) in one method occurs probably 20 times, but each such request must work with paging. Yes, it’s not gut that Model.where occurs so many times, but refactorings are already planned. However, until it comes, I would really like not to write the paginate(:per_page....) line after each Model.where(...). Is there any way to make ".paginate()" apply to every search or work with search results? Those. for example, so that before respond_with(@books) I can safely write .paginate ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question