Skip to content

Commit

Permalink
Fixed a bug where overriding params stopped working
Browse files Browse the repository at this point in the history
closes #919
  • Loading branch information
yuki24 committed Oct 17, 2017
1 parent 23e4737 commit e32c61c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kaminari-core/lib/kaminari/helpers/tags.rb
Expand Up @@ -24,7 +24,7 @@ def initialize(template, params: {}, param_name: nil, theme: nil, views_prefix:
@params = @params.to_unsafe_h if @params.respond_to?(:to_unsafe_h)
@params = @params.with_indifferent_access
@params.except!(*PARAM_KEY_BLACKLIST)
@params.reverse_merge! params
@params.merge! params
end

def to_s(locals = {}) #:nodoc:
Expand Down
7 changes: 7 additions & 0 deletions kaminari-core/test/helpers/action_view_extension_test.rb
Expand Up @@ -28,6 +28,13 @@ class ActionViewExtensionTest < ActionView::TestCase
end
end

test 'allows for overriding params with the :params option' do
view.params[:controller], view.params[:action] = 'addresses', 'new'
users = User.page(1)

assert_match '/users?page=2', view.paginate(users, params: { controller: 'users', action: 'index' })
end

test 'accepts :theme option' do
users = User.page(1)
begin
Expand Down

0 comments on commit e32c61c

Please sign in to comment.