From fb9316f91f74f421f23f331c8df6cc237759cf21 Mon Sep 17 00:00:00 2001 From: Yuki Nishijima Date: Sun, 3 Jan 2016 09:15:37 +0000 Subject: [PATCH] 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. --- lib/kaminari/helpers/tags.rb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/kaminari/helpers/tags.rb b/lib/kaminari/helpers/tags.rb index 2c3968c..f8d7520 100644 --- a/lib/kaminari/helpers/tags.rb +++ b/lib/kaminari/helpers/tags.rb @@ -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: