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

Merge pull request #1085 from pechkin/master

Devise.mailer
This commit is contained in:
José Valim 2011-05-23 08:05:38 -07:00
commit 75490d0375
2 changed files with 14 additions and 11 deletions

View file

@ -237,9 +237,20 @@ module Devise
yield self
end
class Getter
def initialize name
@name = name
end
def get
ActiveSupport::Dependencies.constantize(@name)
end
end
def self.ref(arg)
if defined?(ActiveSupport::Dependencies::ClassCache)
ActiveSupport::Dependencies::Reference.store(arg)
ActiveSupport::Dependencies::reference(arg)
Getter.new(arg)
else
ActiveSupport::Dependencies.ref(arg)
end
@ -251,12 +262,8 @@ module Devise
# Get the mailer class from the mailer reference object.
def self.mailer
if defined?(ActiveSupport::Dependencies::ClassCache)
@@mailer_ref.get "Devise::Mailer"
else
@@mailer_ref.get
end
end
# Set the mailer reference object to access the mailer.
def self.mailer=(class_name)

View file

@ -74,12 +74,8 @@ module Devise
# Gives the class the mapping points to.
def to
if defined?(ActiveSupport::Dependencies::ClassCache)
@ref.get @class_name
else
@ref.get
end
end
def strategies
@strategies ||= STRATEGIES.values_at(*self.modules).compact.uniq.reverse