AnApprentice
AnApprentice

Reputation: 110960

Devise, how to create a edit profile page

I have a Rails 3 App using devise. I want to create a User/Profile edit page. Where a user can edit the name, add/change their photo etc...

I'd like to do this in the right rails/devise way. What's the way of handling this? I see a app/views/devise/registrations/edit.html.erb file

Do I edit that file?

Or do I create a app/views/users/edit.html.erb and customize that experience? But then what do you do regarding the controller? Create a new controller?

Thanks

Upvotes: 8

Views: 8041

Answers (2)

Lance Gleason
Lance Gleason

Reputation: 24

You could also create a user profile edit page directly from a controller of your choice in the app that modifies your user model appropriately.

Upvotes: 0

Matheus Moreira
Matheus Moreira

Reputation: 17020

You may edit the devise/registrations/edit.html.{erb,haml} file and customize it to your needs, maybe even add any additional fields that may be in your user model but not on the form.

I believe it's also possible to have a common CRUD interface for users along with the Devise's, but then you'd have to create a new controller and add the views and everything, so it is easier and preferable to simply override Devise's views to change or add what you need.

You can generate them with rails g devise:views.

Upvotes: 13

Related Questions