stewart715
stewart715

Reputation: 5647

rails append url

I've seen some posts that talk about appending URLs but I haven't really found anything that will help me in my views. I have some links that I would like to append the current URL to add additional parameters.

Is there a standard practice for this in rails?

Upvotes: 0

Views: 600

Answers (3)

Mario Uher
Mario Uher

Reputation: 12397

I prefer url_for(:a => 'test') or for example users_path(:a => 'test').

Upvotes: 1

kain
kain

Reputation: 5570

my_params = {
    'a' => 'test'
}
url_for(my_params)

Upvotes: 1

Sam 山
Sam 山

Reputation: 42865

there are a lot of ways to do this.

params = "?a=test"
url = request.full_path << params

Upvotes: 0

Related Questions