Class: Kaminari::Helpers::PrevPage

Inherits:
Tag
  • Object
show all
Includes:
Link
Defined in:
lib/kaminari/helpers/tags.rb

Overview

The “previous” page of the current page

Instance Method Summary collapse

Methods included from Link

#to_s, #url

Methods inherited from Tag

#page_url_for, #to_s

Constructor Details

#initialize(template, params: {}, param_name: nil, theme: nil, views_prefix: nil, **options) ⇒ PrevPage

TODO: Remove this initializer before 1.3.0.



122
123
124
125
126
127
128
129
130
131
# File 'lib/kaminari/helpers/tags.rb', line 122

def initialize(template, params: {}, param_name: nil, theme: nil, views_prefix: nil, **options) #:nodoc:
  # params in Rails 5 may not be a Hash either,
  # so it must be converted to a Hash to be merged into @params
  if params && params.respond_to?(:to_unsafe_h)
    ActiveSupport::Deprecation.warn 'Explicitly passing params to helpers could be omitted.'
    params = params.to_unsafe_h
  end

  super(template, params: params, param_name: param_name, theme: theme, views_prefix: views_prefix, **options)
end

Instance Method Details

#pageObject

:nodoc:



133
134
135
# File 'lib/kaminari/helpers/tags.rb', line 133

def page #:nodoc:
  @options[:current_page] - 1
end