ruby on rails - add devise:confirmable to 2 models -
can give me example of how add devise 2 different models existing databases,i have 2 models, customer , vendor.if add :confirmable on both models , migration rails g migration add_confirmable_to_devise
confirmable option included in both models after migrate database?
no have create 2 separate migrations:
rails g migration add_devise_fields_to_customer
class adddevisefieldstocustomer < activerecord::migration def change # confirmable columns add_column :customers, :confirmation_token, :string add_column :customers, :confirmed_at, :datetime add_column :customers, :confirmation_sent_at, :datetime add_column :customers, :unconfirmed_email, :string end end
rails g migration add_devise_fields_to_vendor
class adddevisefieldstovendor < activerecord::migration def change # confirmable columns add_column :vendors, :confirmation_token, :string add_column :vendors, :confirmed_at, :datetime add_column :vendors, :confirmation_sent_at, :datetime add_column :vendors, :unconfirmed_email, :string end end
that confirmable module specified. if wanted other devise modules (trackable, databaseauthenticatable etc) need add columns migration too.
you have add :confirmable (and other features wanted) models themselves.
Comments
Post a Comment