diff --git a/lib/pagy/frontend.rb b/lib/pagy/frontend.rb index 8f855e253..b6ce3c0a7 100644 --- a/lib/pagy/frontend.rb +++ b/lib/pagy/frontend.rb @@ -17,8 +17,6 @@ def pagy_url_for(page, pagy, path_or_url=:path) "#{request.send(path_or_url)}?#{Rack::Utils.build_nested_query(pagy_get_params(params))}#{p_vars[:anchor]}" end - - # Sub-method called only by #pagy_url_for: here for easy customization of params by overriding def pagy_get_params(params) params end end diff --git a/test/pagy/extras/trim_test.rb b/test/pagy/extras/trim_test.rb index 534d733db..4bce1db8e 100644 --- a/test/pagy/extras/trim_test.rb +++ b/test/pagy/extras/trim_test.rb @@ -38,7 +38,7 @@ pagy = Pagy.new(count: 1000, params: {a:3,b:4}) link = frontend.pagy_link_proc(pagy) link.call(1).must_equal("1") - link.call(10).must_equal("10") + link.call(10).must_equal("10") end end diff --git a/test/pagy/frontend_test.rb b/test/pagy/frontend_test.rb index bc2837cc1..ad74a6526 100644 --- a/test/pagy/frontend_test.rb +++ b/test/pagy/frontend_test.rb @@ -188,7 +188,7 @@ it 'renders url with params' do pagy = Pagy.new count: 1000, page: 3, params: {a: 3, b: 4} - frontend.pagy_url_for(5, pagy).must_equal '/foo?page=5&a=3&b=4' + frontend.pagy_url_for(5, pagy).must_equal "/foo?a=3&b=4&page=5" end it 'renders url with anchor' do @@ -198,7 +198,7 @@ it 'renders url with params and anchor' do pagy = Pagy.new count: 1000, page: 3, params: {a: 3, b: 4}, anchor: '#anchor' - frontend.pagy_url_for(5, pagy).must_equal '/foo?page=5&a=3&b=4#anchor' + frontend.pagy_url_for(5, pagy).must_equal "/foo?a=3&b=4&page=5#anchor" end end @@ -208,7 +208,7 @@ it 'overrides params' do overridden = TestViewOverride.new pagy = Pagy.new count: 1000, page: 3, params: {a: 3, b: 4}, anchor: '#anchor' - overridden.pagy_url_for(5, pagy).must_equal '/foo?page=5&b=4&k=k#anchor' + overridden.pagy_url_for(5, pagy).must_equal "/foo?b=4&page=5&k=k#anchor" end end