Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 37 lines (34 sloc) 1.227 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
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.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. By default, do nothing on ActiveRecord.
      def self.included_modules_hook(klass, modules)
      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
Something went wrong with that request. Please try again.