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

Fixed a bug where overriding params stopped working

closes #919
This commit is contained in:
Yuki Nishijima 2017-10-17 15:08:25 -04:00
parent 23e4737720
commit e32c61cf6e
2 changed files with 8 additions and 1 deletions

View file

@ -24,7 +24,7 @@ module Kaminari
@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:

View file

@ -28,6 +28,13 @@ if defined?(::Rails::Railtie) && defined?(::ActionView)
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