Browse files

first commit

  • Loading branch information...
0 parents commit e49836665089f64711ab23be2a0c75bfcad1f2db Francisco Treacy committed May 28, 2010
Showing with 49 additions and 0 deletions.
  1. +5 −0 README.md
  2. +44 −0 lib/devise/orm/ripple.rb
5 README.md
@@ -0,0 +1,5 @@
+## devise-ripple
+
+An "ORM" strategy to use Devise with Riak (through the Ripple Ruby client)
+
+It is thoroughly untested - works for me in a very basic scenario. Work in progress - please do contribute!
44 lib/devise/orm/ripple.rb
@@ -0,0 +1,44 @@
+module Devise
+ module Orm
+ module Ripple
+ module Hook
+ def devise_modules_hook!
+ extend Schema
+ include ::Ripple::Document::Timestamps
+ include Compatibility
+ yield
+ return unless Devise.apply_schema
+ devise_modules.each { |m| send(m) if respond_to?(m, true) }
+ end
+ end
+
+ module Schema
+ include Devise::Schema
+
+ def apply_schema(name, type, options={})
+ return unless Devise.apply_schema
+ property name, :cast_as => type
+ end
+ end
+
+ module Compatibility
+ extend ActiveSupport::Concern
+
+ module ClassMethods
+
+ def find(*args)
+ puts "Entering find method with args => #{args}"
+ super(args[1][:conditions][:email]) if args[1][:conditions].include? :email
+ end
+
+ end
+
+ end
+ end
+ end
+end
+
+Ripple::EmbeddedDocument::ClassMethods.class_eval do
+ include Devise::Models
+ include Devise::Orm::Ripple::Hook
+end

0 comments on commit e498366

Please sign in to comment.