Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Depend on ORM Adapter.

  • Loading branch information...
commit 8a8ba6c70c5ce7a454048a8261bbd996d387bc55 1 parent b409184
José Valim josevalim authored
6 Gemfile
View
@@ -7,6 +7,12 @@ gem "webrat", "0.7.1"
gem "mocha", :require => false
gem "oauth2"
+if File.exist?("../orm_adapter")
+ gem "orm_adapter", :path => "../orm_adapter"
+else
+ gem "orm_adapter", :git => "http://github.com/ianwhite/orm_adapter.git"
+end
+
platforms :jruby do
gem 'activerecord-jdbcsqlite3-adapter'
end
6 Gemfile.lock
View
@@ -5,6 +5,11 @@ PATH
bcrypt-ruby (~> 2.1.2)
warden (~> 1.0.0)
+PATH
+ remote: /Users/jose/Work/github/orm_adapter
+ specs:
+ orm_adapter (0.0.1)
+
GEM
remote: http://rubygems.org/
specs:
@@ -126,6 +131,7 @@ DEPENDENCIES
mongo (= 1.0.7)
mongoid (= 2.0.0.beta.18)
oauth2
+ orm_adapter!
rails (= 3.0.0)
ruby-debug (>= 0.10.3)
sqlite3-ruby
2  app/controllers/devise/registrations_controller.rb
View
@@ -104,6 +104,6 @@ def after_update_path_for(resource)
# the current user in place.
def authenticate_scope!
send(:"authenticate_#{resource_name}!")
- self.resource = resource_class.find(send(:"current_#{resource_name}").id)
+ self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
end
end
1  lib/devise.rb
View
@@ -1,5 +1,6 @@
require 'active_support/core_ext/numeric/time'
require 'active_support/dependencies'
+require 'orm_adapter'
require 'set'
module Devise
4 lib/devise/models/authenticatable.rb
View
@@ -100,7 +100,7 @@ def http_authenticatable?(strategy)
# end
#
def find_for_authentication(conditions)
- find(:first, :conditions => conditions)
+ to_adapter.find_first(conditions)
end
# Find an initialize a record setting an error if it can't be found.
@@ -114,7 +114,7 @@ def find_or_initialize_with_errors(required_attributes, attributes, error=:inval
attributes.delete_if { |key, value| value.blank? }
if attributes.size == required_attributes.size
- record = find(:first, :conditions => attributes)
+ record = to_adapter.find_first(attributes)
end
unless record
2  lib/devise/models/rememberable.rb
View
@@ -105,7 +105,7 @@ def serialize_into_cookie(record)
# Recreate the user based on the stored cookie
def serialize_from_cookie(id, remember_token)
- record = find(:first, :conditions => { :id => id.first })
+ record = to_adapter.get(id)
record if record && record.rememberable_value == remember_token && !record.remember_expired?
end
2  lib/devise/orm/active_record.rb
View
@@ -1,3 +1,5 @@
+require 'orm_adapter/adapters/active_record'
+
module Devise
module Orm
# This module contains some helpers and handle schema (migrations):
2  lib/devise/orm/mongoid.rb
View
@@ -1,3 +1,5 @@
+require 'orm_adapter/adapters/mongoid'
+
module Devise
module Orm
module Mongoid
Please sign in to comment.
Something went wrong with that request. Please try again.