Skip to content

Instantly share code, notes, and snippets.

@yorzi
Created July 6, 2011 08:39
Show Gist options
  • Save yorzi/1066846 to your computer and use it in GitHub Desktop.
Save yorzi/1066846 to your computer and use it in GitHub Desktop.
create a pageless page, click "more" for new paginated results.
# usage:
# link_to_next_page(@items)
# link_to_next_page(@items, :remote => true) # Ajax
def link_to_next_page(scope, name, options = {}, &block)
param_name = options.delete(:param_name) || Kaminari.config.param_name
link_to_unless scope.last_page?, name, {param_name => (scope.current_page + 1)}, options.merge(:rel => 'next') do
block.call if block
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment