Module: Devise::Migrations
- Defined in:
- lib/devise/migrations.rb
Overview
Helpers to migration:
create_table :accounts do |t|
t.authenticatable
t.confirmable
t.recoverable
t.rememberable
t.
end
However this method does not add indexes. If you need them, here is the declaration:
add_index "accounts", ["email"], :name => "email", :unique => true
add_index "accounts", ["confirmation_token"], :name => "confirmation_token", :unique => true
add_index "accounts", ["reset_password_token"], :name => "reset_password_token", :unique => true
Instance Method Summary collapse
-
#authenticatable(options = {}) ⇒ Object
Creates email, encrypted_password and password_salt.
-
#confirmable ⇒ Object
Creates confirmation_token, confirmed_at and confirmation_sent_at.
-
#recoverable ⇒ Object
Creates reset_password_token.
-
#rememberable ⇒ Object
Creates remember_token and remember_created_at.
Instance Method Details
#authenticatable(options = {}) ⇒ Object
Creates email, encrypted_password and password_salt.
22 23 24 25 26 27 |
# File 'lib/devise/migrations.rb', line 22 def authenticatable(={}) null = [:null] || false string :email, :limit => 100, :null => null string :encrypted_password, :limit => 40, :null => null string :password_salt, :limit => 20, :null => null end |
#confirmable ⇒ Object
Creates confirmation_token, confirmed_at and confirmation_sent_at.
31 32 33 34 35 |
# File 'lib/devise/migrations.rb', line 31 def confirmable string :confirmation_token, :limit => 20 datetime :confirmed_at datetime :confirmation_sent_at end |
#recoverable ⇒ Object
Creates reset_password_token.
39 40 41 |
# File 'lib/devise/migrations.rb', line 39 def recoverable string :reset_password_token, :limit => 20 end |
#rememberable ⇒ Object
Creates remember_token and remember_created_at.
45 46 47 48 |
# File 'lib/devise/migrations.rb', line 45 def rememberable string :remember_token, :limit => 20 datetime :remember_created_at end |