1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00

hwia the given params per each tag only once

This commit is contained in:
Akira Matsuda 2015-07-24 07:31:18 +09:00
parent 56ab06144c
commit c4125e72f5
2 changed files with 4 additions and 3 deletions

View file

@ -21,6 +21,7 @@ module Kaminari
@theme = @options.delete(:theme)
@views_prefix = @options.delete(:views_prefix)
@params = template.params.except(*PARAM_KEY_BLACKLIST).merge(@options.delete(:params) || {})
@params = @params.with_indifferent_access
end
def to_s(locals = {}) #:nodoc:
@ -35,7 +36,7 @@ module Kaminari
def params_for(page)
page_params = Rack::Utils.parse_nested_query("#{@param_name}=#{page}")
page_params = @params.with_indifferent_access.deep_merge(page_params)
page_params = @params.deep_merge(page_params)
if !Kaminari.config.params_on_first_page && (page <= 1)
# This converts a hash:

View file

@ -26,7 +26,7 @@ describe 'Kaminari::Helpers::Paginator' do
@paginator = Paginator.new(template, :params => {:controller => 'foo', :action => 'bar'})
end
subject { @paginator.page_tag(template).instance_variable_get('@params') }
it { should == {:controller => 'foo', :action => 'bar'} }
it { should == {'controller' => 'foo', 'action' => 'bar'} }
context "when params has form params" do
before do
@ -40,7 +40,7 @@ describe 'Kaminari::Helpers::Paginator' do
end
end
it { should == {:controller => 'foo', :action => 'bar'} }
it { should == {'controller' => 'foo', 'action' => 'bar'} }
end
end