What is the Rails way to split a view into separate pages?

In my view / show, I show a lot of data that I want to separate into separate pages (in this case, three pages). I can do this easily by adding a new action and view for each additional page, but is this the “right” way to do this in Rails?

+4
source share
2 answers

Great question!

I can do this easily by adding a new action and view for each additional page, but is this the “right” way to do this in Rails?

I suspect that you are not sure about the violation of REST?

I don’t know what data you are showing, but in the end the best and easiest solution for you (the code of the wise) and your users (the design of the wise) should win if this means adding a new action, so be sure to avoid adding a new controller only for new show action.

+2
source

Are you looking for a pagination solution? If so, I would suggest either kaminari or will_paginate . In addition, each of them has railscast, if you need help setting up.

0
source

All Articles