Module: Pagy::Frontend::UseItemsExtra

Included in:
Pagy::Frontend
Defined in:
lib/pagy/extras/items.rb

Instance Method Summary collapse

Instance Method Details

#pagy_url_for(page, pagy, url = nil) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/pagy/extras/items.rb', line 40

def pagy_url_for(page, pagy, url=nil)
  p_vars = pagy.vars
  params = request.GET.merge(p_vars[:params])
  params[p_vars[:page_param].to_s]  = page
  params[p_vars[:items_param].to_s] = p_vars[:items]
  "#{request.base_url if url}#{request.path}?#{Rack::Utils.build_nested_query(pagy_get_params(params))}#{p_vars[:anchor]}"
end