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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -