Method: Kaminari::ActionViewExtension#link_to_next_page
- Defined in:
- lib/kaminari/helpers/action_view_extension.rb
#link_to_next_page(scope, name, options = {}, &block) ⇒ Object
A simple “Twitter like” pagination link that creates a link to the next page.
Examples
Basic usage:
<%= link_to_next_page @items, 'Next Page' %>
Ajax:
<%= link_to_next_page @items, 'Next Page', :remote => true %>
By default, it renders nothing if there are no more results on the next page. You can customize this output by passing a block.
<%= link_to_next_page @users, 'Next Page' do %>
<span>No More Pages</span>
<% end %>
39 40 41 42 43 44 45 |
# File 'lib/kaminari/helpers/action_view_extension.rb', line 39 def link_to_next_page(scope, name, = {}, &block) params = .delete(:params) || {} param_name = .delete(:param_name) || Kaminari.config.param_name link_to_unless scope.last_page?, name, params.merge(param_name => (scope.current_page + 1)), .reverse_merge(:rel => 'next') do block.call if block end end |