Tall Paul
Tall Paul

Reputation: 2450

Rails Edit User Path Not Working

I have made a rails project with authentication being devise. I am having an issue though with getting to the edit users page.

What happens is when I manually go to /users/1/edit I can see the edit page. Though I cannot seem to figure out the route to put in my code. When I look at the routes it looks like all I have to do is edit_user_path. Though this brings me to /user/1/edit. Which is incorrect and does not work. I have tried to do edit_users_path which just fails.

This is my routes file

devise_for :users
resources :users, :only => [:show, :edit, :update ]
resources :users, :controller => "users"

Any help would be appreciated

Upvotes: 2

Views: 4665

Answers (2)

Ken
Ken

Reputation: 184

To add to RSB answer.. I had the same issue:

edit_user_path(current_user)

fixed it.

Upvotes: 2

Rajdeep Singh
Rajdeep Singh

Reputation: 17834

I think you have missed passing user object or id with the path, use this instead

edit_user_path(user.id)

where user is the object. You can also pass object

edit_user_path(user)

Upvotes: 6

Related Questions