Steve
Steve

Reputation: 592

Adding url parameters with redirect_to

Is it possible to pass url parameters with this type of redirect_to?

redirect_to contact_path(@contact), :show_family => 'yes'

I want a URL that results in:

/contacts/1?show_family=yes

Upvotes: 9

Views: 4540

Answers (1)

Alex Reisner
Alex Reisner

Reputation: 29442

Yes, just pass your query string parameters in to contact_path:

redirect_to contact_path(@contact, :show_family => 'yes')

Upvotes: 14

Related Questions