1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Depend on ORM Adapter.

This commit is contained in:
José Valim 2010-10-10 17:51:12 +02:00
parent b409184a98
commit 8a8ba6c70c
8 changed files with 21 additions and 4 deletions

View file

@ -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

View file

@ -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

View file

@ -104,6 +104,6 @@ class Devise::RegistrationsController < ApplicationController
# 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

View file

@ -1,5 +1,6 @@
require 'active_support/core_ext/numeric/time'
require 'active_support/dependencies'
require 'orm_adapter'
require 'set'
module Devise

View file

@ -100,7 +100,7 @@ module Devise
# 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 @@ module Devise
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

View file

@ -105,7 +105,7 @@ module Devise
# 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

View file

@ -1,3 +1,5 @@
require 'orm_adapter/adapters/active_record'
module Devise
module Orm
# This module contains some helpers and handle schema (migrations):

View file

@ -1,3 +1,5 @@
require 'orm_adapter/adapters/mongoid'
module Devise
module Orm
module Mongoid