Sha256: 30d77df808338808fb63f5dea1c861bc998c9aea0efb378183a769249afe51d1

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 KB

Contents

module Devise
  module Orm
    # 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
    #
    module ActiveRecord
      # Required ORM hook. Just yield the given block in ActiveRecord.
      def self.included_modules_hook(klass, modules)
        yield
      end

      include Devise::Schema

      # Tell how to apply schema methods.
      def apply_schema(name, type, options={})
        column name, type.to_s.downcase.to_sym, options
      end
    end
  end
end

if defined?(ActiveRecord)
  ActiveRecord::Base.extend Devise::Models
  ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Devise::Orm::ActiveRecord
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
devise-0.9.2 lib/devise/orm/active_record.rb
devise-0.9.1 lib/devise/orm/active_record.rb
devise-0.9.0 lib/devise/orm/active_record.rb