You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 25, 2021. It is now read-only.
Repository navigation
How To: Change an already existing table to add devise required columns
LConrad edited this page Jun 1, 2012
·
2 revisions
The following migration can be used to add devise required columns to an existing users table.
classAddDeviseColumnsToUser < ActiveRecord::Migrationdefchangechange_table:usersdo |t|
# if you already have a email column, you have to comment the below line and add the :encrypted_password column manually (see devise/schema.rb).t.database_authenticatablet.confirmablet.recoverablet.rememberablet.trackablet.token_authenticatablet.timestampsendendend
Note: If your existing users table already has a column email, then Devise's t.database_authenticatable will fail, because it tries to add email again. t.database_authenticatable will add two columns, email and encrypted_password. If email already exists, then just manually add the encrypted_password, in lieu of t.database_authenticatable: