Alain Goldman
Alain Goldman

Reputation: 2908

rails: redirect_to with object params

I want to redirect_to with object parameters. I've tried doing it different ways but none of them worked.

redirect_to user_path(params[:current_user.id])

redirect_to user_path(params[:current_user(params[:id])])

How am I supposed to do it?

Upvotes: 0

Views: 822

Answers (2)

tihom
tihom

Reputation: 8003

 redirect_to user_path(current_user)
 #=> redirects to users/:id where :id is current_user.id

Upvotes: 2

Erik Kaplun
Erik Kaplun

Reputation: 38217

How about just:

redirect_to user_path(current_user.id)

Upvotes: 1

Related Questions