Created
December 16, 2011 21:27
-
-
Save adelevie/1488065 to your computer and use it in GitHub Desktop.
parse_resource ORM adapter for Devise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#require 'orm_adapter/adapters/mongo_mapper' | |
module Devise | |
module Orm | |
module ParseResource | |
extend ActiveSupport::Concern | |
included do | |
extend Devise::Models | |
extend Devise::Orm::ParseResource::Hook | |
end | |
module Hook | |
def devise_modules_hook! | |
extend Schema | |
yield | |
return unless Devise.apply_schema | |
devise_modules.each { |m| send(m) if respond_to?(m, true) } | |
end | |
end | |
module Schema | |
include Devise::Schema | |
# Tell how to apply schema methods | |
def apply_devise_schema(name, type, options={}) | |
#type = Time if type == DateTime | |
#key(name, type, options) | |
field(name) | |
end | |
end | |
end | |
end | |
end | |
ParseResource::Base.extend Devise::Models | |
ParseResource::Base.send :include, Devise::Orm::ParseResource::Schema | |
#ActiveRecord::ConnectionAdapters::Table.send :include, Devise::Orm::ActiveRecord::Schema | |
#ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Devise::Orm::ActiveRecord::Schema |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey,
I stumbled upon this when I was looking for a way to use Devise and Parse Resource.
Does it work?
How does one implement it?