Module: SimplePaginate::ActionViewExtension

Defined in:
lib/simple_paginate/helpers/action_view_extension.rb

Instance Method Summary collapse

Instance Method Details



14
15
16
17
# File 'lib/simple_paginate/helpers/action_view_extension.rb', line 14

def link_to_next_page(scope, name = nil, options = {})
  next_page = SimplePaginate::Helpers::NextPage.new self, options.reverse_merge(current_page: scope.current_page)
  link_to_unless scope.last_page?, name, next_page.url, options.except(:params, :param_name).reverse_merge(rel: 'next')
end


9
10
11
12
# File 'lib/simple_paginate/helpers/action_view_extension.rb', line 9

def link_to_previous_page(scope, name = nil, options = {})
  prev_page = SimplePaginate::Helpers::PrevPage.new self, options.reverse_merge(current_page: scope.current_page)
  link_to_unless scope.first_page?, name, prev_page.url, options.except(:params, :param_name).reverse_merge(rel: 'prev')
end

#simple_paginate(scope, options = {}) ⇒ Object

A helper that renders the pagination links



4
5
6
7
# File 'lib/simple_paginate/helpers/action_view_extension.rb', line 4

def simple_paginate(scope, options = {})
  paginator = SimplePaginate::Helpers::Paginator.new self, options.reverse_merge(current_page: scope.current_page, per_page: scope.limit_value, length: scope.actual_records_length)
  paginator.to_s
end