current_url for Rails

No explanation needed

  # https://x.com/y/1?page=1 
  # + current_url( :page => 3 )
  # = https://x.com/y/1?page=3
  def current_url(overwrite={})
    url_for :only_path => false, :params => params.merge(overwrite)
  end

One thought on “current_url for Rails

  1. Thanks for this, it helped me work around the :overwrite_params deprecation warning for url_for().

Leave a reply to Matt N Cancel reply