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:
parent
56ab06144c
commit
c4125e72f5
2 changed files with 4 additions and 3 deletions
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue