I have data and it will be cut on some pages (10 results per page).
code in the controller:
@messages = Message.order('id DESC').page params[:page]
How can I show all the results on one page if I want? This is similar to 'see all' on the navigation page.
'see all'
You can set a very high limit in the per_page parameter 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
Source: https://habr.com/ru/post/922170/More articles:How can I create a unique dom identifier for an html tag from a model - ruby-on-railsException: Cannot find class SolrCoreAware - solrStarting external activity when the phone is locked - androidhiding __proto__ property in Chrome console - javascriptRails Kaminari - How to order / paginate Arrays? - ruby-on-railsChoosing a custom output cache provider for specific controller actions - c #How does the preprocessor macro work? - cHow do you handle Ajax requests in Spring MVC? - javaStop MAMP MySQL - mysqlHow to write compile time for a user - c ++All Articles