Module: Devise::Orm::ActiveRecord

Includes:
Schema
Defined in:
lib/devise/orm/active_record.rb

Overview

This module contains some helpers and handle schema (migrations):

create_table :accounts do |t|
  t.authenticatable
  t.confirmable
  t.recoverable
  t.rememberable
  t.trackable
  t.lockable
  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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Schema

#authenticatable, #confirmable, #database_authenticatable, #lockable, #recoverable, #rememberable, #token_authenticatable, #trackable

Class Method Details

.included_modules_hook(klass) ⇒ Object

Required ORM hook. Just yield the given block in ActiveRecord.



23
24
25
# File 'lib/devise/orm/active_record.rb', line 23

def self.included_modules_hook(klass)
  yield
end

Instance Method Details

#apply_schema(name, type, options = {}) ⇒ Object

Tell how to apply schema methods.



30
31
32
# File 'lib/devise/orm/active_record.rb', line 30

def apply_schema(name, type, options={})
  column name, type.to_s.downcase.to_sym, options
end