Kwargsifying `params` parameter for Tag.new
This commit is contained in:
parent
13389ff632
commit
647eb5857d
|
@ -16,14 +16,14 @@ module Kaminari
|
|||
# installed template will be used.
|
||||
# e.g.) Paginator -> $GEM_HOME/kaminari-x.x.x/app/views/kaminari/_paginator.html.erb
|
||||
class Tag
|
||||
def initialize(template, param_name: nil, theme: nil, views_prefix: nil, **options) #:nodoc:
|
||||
def initialize(template, params: {}, param_name: nil, theme: nil, views_prefix: nil, **options) #:nodoc:
|
||||
@template, @options = template, options.dup
|
||||
@param_name = param_name || Kaminari.config.param_name
|
||||
@theme, @views_prefix = theme, views_prefix
|
||||
@params = template.params
|
||||
# @params in Rails 5 no longer inherits from Hash
|
||||
@params = @params.to_unsafe_h if @params.respond_to?(:to_unsafe_h)
|
||||
@params = @params.with_indifferent_access.except(*PARAM_KEY_BLACKLIST).merge(@options.delete(:params) || {})
|
||||
@params = @params.with_indifferent_access.except(*PARAM_KEY_BLACKLIST).merge(params)
|
||||
end
|
||||
|
||||
def to_s(locals = {}) #:nodoc:
|
||||
|
|
Loading…
Reference in New Issue