Eki Eqbal
Eki Eqbal

Reputation: 6027

How to add params to redirect_to and a route (Rails)?

I'm trying to add a param to a url path with:

redirect_to user_home_url(current_user, popup: true)

I want to generate:

http://user_home_url?popup=true

For some reason I'm getting the following error:

wrong number of arguments (2 for 1)

What am I doing wrong here?

Please note I'm NOT using the following format:

redirect_to :controller => 'controller_name', :action => action_name, :param =>'param'

I'm using Rails 3.2.0.

Thanks

Upvotes: 0

Views: 196

Answers (1)

Claudi
Claudi

Reputation: 5416

Use user_home_path instead of user_home_url:

redirect_to user_home_path(current_user, popup: true)

Upvotes: 1

Related Questions