I\'d like to write an extension for Devise that allows you to use parse_resource as the datastore (as opposed to ActiveRecord). parse_resource is a Ruby wrapper for Parse.com\'s
For a good start you can check out the couchDB extension and the Riak extension as well. You can see that in the Hook module you override anything you want/must for making the Devise to work.
Can you see the class_eval declaration at the bottom? There you extend the class (in your case the ParseResource::Base
) with the Devise::Models
module, which holds all the necessary methods (including the famous devise
method as you can see), and next with the Hooks
module if you want to override anything (the MongoMapper extension doen't need to override anything, that's why is not using this method). Thus you must write:
module Devise
module Orm
module ParseResource
module Hooks
# here you define any overrides
end
end
end
end
ParseResource::Base.class_eval do
extend Devise::Models
extend Devise::Orm::ParseResource::Hooks
end
After that you must require 'devise/orm/parse_resource'
(assuming you have named the file parse_resource.rb
) in your #{Rails.root}/config/initializers/devise.rb
initializer. Hope I helped a bit :)