简体   繁体   中英

show all results on one page (gem kaminari)

I have data and they be cut on some pages (10 results per page).

code in controller:

@messages = Message.order('id DESC').page params[:page]

How I can show all results on one page if I want? It similar as 'see all' on page navigate.

You can put a very high limit in the per_page option if you still want the paginate helpers to work in your view.

@messages = Message.order('id DESC').page params[:page]
if params[:all]
  @messages = @messages.per_page(Message.count) # you can also hardcod' it
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM