Reputation: 22404
Simple question - how do I get the path or full URL of the current action INCLUDING the query string?
I wish to save it to the session variable like so:
def show
@thingy = Thingy.find(params[:id])
session[:some_var] = current_url
...
end
At the moment I'm doing the following, but it seems a bit heavy-handed (especially the specifying of query string params individually):
def show
@thingy = Thingy.find(params[:id])
session[:some_var] = thingy_path(@thingy, :q1 => params[:q1], :q2 => params[:q2])
...
end
Upvotes: 9
Views: 11146
Reputation: 6942
access params
variable,it will give you query as well as controller
and action
.
By using request
object you can dig more deeper if you want.
Upvotes: 2