Module: SimplePaginate::ActionViewExtension
- Defined in:
- lib/simple_paginate/helpers/action_view_extension.rb
Instance Method Summary collapse
- #link_to_next_page(scope, name = nil, options = {}) ⇒ Object
- #link_to_previous_page(scope, name = nil, options = {}) ⇒ Object
-
#simple_paginate(scope, options = {}) ⇒ Object
A helper that renders the pagination links.
Instance Method Details
#link_to_next_page(scope, name = nil, options = {}) ⇒ Object
14 15 16 17 |
# File 'lib/simple_paginate/helpers/action_view_extension.rb', line 14 def link_to_next_page(scope, name = nil, = {}) next_page = SimplePaginate::Helpers::NextPage.new self, .reverse_merge(current_page: scope.current_page) link_to_unless scope.last_page?, name, next_page.url, .except(:params, :param_name).reverse_merge(rel: 'next') end |
#link_to_previous_page(scope, name = nil, options = {}) ⇒ Object
9 10 11 12 |
# File 'lib/simple_paginate/helpers/action_view_extension.rb', line 9 def link_to_previous_page(scope, name = nil, = {}) prev_page = SimplePaginate::Helpers::PrevPage.new self, .reverse_merge(current_page: scope.current_page) link_to_unless scope.first_page?, name, prev_page.url, .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, = {}) paginator = SimplePaginate::Helpers::Paginator.new self, .reverse_merge(current_page: scope.current_page, per_page: scope.limit_value, length: scope.actual_records_length) paginator.to_s end |