Sha256: 66d77df2bf1847ef0323d96893ac771857578c9d0d508e7e33846cb067f69612

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

module Devise
  # Helpers to migration:
  #
  #   create_table :accounts do |t|
  #     t.authenticatable
  #     t.confirmable
  #     t.recoverable
  #     t.rememberable
  #     t.timestamps
  #   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
  #
  module Migrations

    # Creates email, encrypted_password and password_salt.
    #
    def authenticatable(options={})
      null = options[:null] || false
      string :email,              :limit => 100, :null => null
      string :encrypted_password, :limit =>  40, :null => null
      string :password_salt,      :limit =>  20, :null => null
    end

    # Creates confirmation_token, confirmed_at and confirmation_sent_at.
    #
    def confirmable
      string   :confirmation_token, :limit => 20
      datetime :confirmed_at
      datetime :confirmation_sent_at
    end

    # Creates reset_password_token.
    #
    def recoverable
      string :reset_password_token, :limit => 20
    end

    # Creates remember_token and remember_created_at.
    #
    def rememberable
      string   :remember_token, :limit => 20
      datetime :remember_created_at
    end

  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
devise-0.4.3 lib/devise/migrations.rb
ramon-devise-0.4.2 lib/devise/migrations.rb
devise-0.4.2 lib/devise/migrations.rb
devise-0.4.1 lib/devise/migrations.rb
devise-0.4.0 lib/devise/migrations.rb