2010-10-10 11:51:12 -04:00
|
|
|
require 'orm_adapter/adapters/active_record'
|
|
|
|
|
2009-11-13 17:54:21 -05:00
|
|
|
module Devise
|
|
|
|
module Orm
|
2009-11-13 19:33:00 -05:00
|
|
|
# This module contains some helpers and handle schema (migrations):
|
|
|
|
#
|
|
|
|
# create_table :accounts do |t|
|
2010-03-29 10:13:19 -04:00
|
|
|
# t.database_authenticatable
|
2009-11-13 19:33:00 -05:00
|
|
|
# t.confirmable
|
|
|
|
# t.recoverable
|
|
|
|
# t.rememberable
|
2009-12-30 12:19:33 -05:00
|
|
|
# t.trackable
|
|
|
|
# t.lockable
|
2009-11-13 19:33:00 -05:00
|
|
|
# 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
|
|
|
|
#
|
2009-11-13 17:54:21 -05:00
|
|
|
module ActiveRecord
|
2010-02-19 03:26:17 -05:00
|
|
|
module Schema
|
|
|
|
include Devise::Schema
|
2009-11-13 17:54:21 -05:00
|
|
|
|
2010-02-19 03:26:17 -05:00
|
|
|
# Tell how to apply schema methods.
|
2010-06-13 05:48:35 -04:00
|
|
|
def apply_devise_schema(name, type, options={})
|
2010-02-19 03:26:17 -05:00
|
|
|
column name, type.to_s.downcase.to_sym, options
|
|
|
|
end
|
2009-11-13 19:33:00 -05:00
|
|
|
end
|
|
|
|
end
|
2009-11-13 17:54:21 -05:00
|
|
|
end
|
|
|
|
end
|
2009-11-13 19:33:00 -05:00
|
|
|
|
2010-04-20 11:22:16 -04:00
|
|
|
ActiveRecord::Base.extend Devise::Models
|
|
|
|
ActiveRecord::ConnectionAdapters::Table.send :include, Devise::Orm::ActiveRecord::Schema
|
|
|
|
ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Devise::Orm::ActiveRecord::Schema
|