How to pass and not a parameter to a link?


Hi, i’ve a page where when a params[:something] is passed all/some the
urls in that page must have the params[:something] too, but when there
isn’t it shouldn’t appear.
I’ve tried with:

report_url(params[:id], :something => params[:something])
this works when there is the params[:something], but it doesn’t when
there isn’t, as the result is:

So i’ve tried with
tmp = params[:something] ? {:something => params[:something]} : {}
report_url(params[:id], tmp)

This is better, because works when there is the parameter, and almost
does when there isn’t, as the result is:

Is there any way to have the two results
http://localhost:300/report/1?something=123 and
http://localhost:300/report/1 when there is and there isn’t the
parameter? Without having the question mark at the end in the second


anyone? :frowning: