5

It seems there's not a whole lot of documentation out there covering how to add custom fields to a Devise authentication solution in a Rails 3 app.

Along with the required e-mail and password for users to sign up, I'd like a few other custom fields put in and validated and since there are no controllers generated with Devise, how does one do this?

2 Answers 2

3

I needed this same thing. There is a great article I found to help me:

http://ykyuen.wordpress.com/2011/03/03/rails-%E2%80%93-add-custom-fields-to-devise-user-model/

Sign up to request clarification or add additional context in comments.

Comments

2

When you do rails generate devise_views all the views for the features you selected will go in your app/views/devise folder. You could simply add the fields defined in your model to those views. If you need to customize the controller, create


class YourModel::DeviseFeaturesController 

by DeviseFeatures I meant RegistrationsController, ConfirmationsController or whichever features you decided to use.

There is a great screencast about it: RailsCasts-customizing-devise

1 Comment

Can you provide an example for us newbies out there? The RailsCasts doesn't dwell into this matter. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.