mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
Call #with_indifferent_access before #except
PARAM_KEY_BLACKLIST is a list of symbols. If params has a string key it won't remove it that should be removed.
This commit is contained in:
parent
7d902ca7b9
commit
fb9316f91f
1 changed files with 4 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
|||
module Kaminari
|
||||
module Helpers
|
||||
PARAM_KEY_BLACKLIST = :authenticity_token, :commit, :utf8, :_method
|
||||
PARAM_KEY_BLACKLIST = :authenticity_token, :commit, :utf8, :_method, :script_name
|
||||
|
||||
# A tag stands for an HTML tag inside the paginator.
|
||||
# Basically, a tag has its own partial template file, so every tag can be
|
||||
|
@ -20,13 +20,10 @@ module Kaminari
|
|||
@param_name = @options.delete(:param_name) || Kaminari.config.param_name
|
||||
@theme = @options.delete(:theme)
|
||||
@views_prefix = @options.delete(:views_prefix)
|
||||
@params = template.params.except(*PARAM_KEY_BLACKLIST).merge(@options.delete(:params) || {})
|
||||
@params = template.params
|
||||
# @params in Rails 5 no longer inherits from Hash
|
||||
if @params.respond_to?(:to_unsafe_h)
|
||||
@params = @params.to_unsafe_h
|
||||
else
|
||||
@params = @params.with_indifferent_access
|
||||
end
|
||||
@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) || {})
|
||||
end
|
||||
|
||||
def to_s(locals = {}) #:nodoc:
|
||||
|
|
Loading…
Add table
Reference in a new issue