lib/pagy/url_helpers.rb in pagy-9.0.8 vs lib/pagy/url_helpers.rb in pagy-9.0.9
- old
+ new
@@ -6,10 +6,10 @@
# Return the URL for the page, relying on the params method and Rack by default.
# It supports all Rack-based frameworks (Sinatra, Padrino, Rails, ...).
# For non-rack environments you can use the standalone extra
def pagy_url_for(pagy, page, absolute: false, fragment: nil, **_)
vars = pagy.vars
- query_params = request.GET.clone
+ query_params = request.GET.clone(freeze: false)
query_params.merge!(vars[:params].transform_keys(&:to_s)) if vars[:params].is_a?(Hash)
pagy_set_query_params(page, vars, query_params)
query_params = vars[:params].(query_params) if vars[:params].is_a?(Proc)
query_string = "?#{Rack::Utils.build_nested_query(query_params)}"
"#{request.base_url if absolute}#{vars[:request_path] || request.path}#{query_string}#{fragment}"