Jim Mitchener
Jim Mitchener

Reputation: 9003

Managing User Accounts with Rails 3 and Devise

I have implemented Devise in a Rails 3 application and I need admin users to be able to manage users. Users are not registerable and therefore an admin must create accounts. What would be the best way to go about this?

It doesn't seem very DRY to create my own UsersController when Devise already provides Devise::RegistrationController but I don't see any other options.

Upvotes: 12

Views: 7744

Answers (2)

Jim Mitchener
Jim Mitchener

Reputation: 9003

I opted to create my own UsersController along side the RegistrationController. It really makes sense to have my own RESTful controller for admin purposes. It's not devise's job to manage user records and maintain administrative fields associated with them. It is, after all, an authentication framework. It just seems correct to leave it to do what it is designed for. You are required to create your own user model for a reason.

Upvotes: 13

pushmatrix
pushmatrix

Reputation: 746

You can override the RegistrationController to provide the functionality you need. Check the first answer from here: Override devise registrations controller

Upvotes: 2

Related Questions