mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
commit
75490d0375
2 changed files with 14 additions and 11 deletions
|
@ -237,9 +237,20 @@ module Devise
|
||||||
yield self
|
yield self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Getter
|
||||||
|
def initialize name
|
||||||
|
@name = name
|
||||||
|
end
|
||||||
|
|
||||||
|
def get
|
||||||
|
ActiveSupport::Dependencies.constantize(@name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.ref(arg)
|
def self.ref(arg)
|
||||||
if defined?(ActiveSupport::Dependencies::ClassCache)
|
if defined?(ActiveSupport::Dependencies::ClassCache)
|
||||||
ActiveSupport::Dependencies::Reference.store(arg)
|
ActiveSupport::Dependencies::reference(arg)
|
||||||
|
Getter.new(arg)
|
||||||
else
|
else
|
||||||
ActiveSupport::Dependencies.ref(arg)
|
ActiveSupport::Dependencies.ref(arg)
|
||||||
end
|
end
|
||||||
|
@ -251,11 +262,7 @@ module Devise
|
||||||
|
|
||||||
# Get the mailer class from the mailer reference object.
|
# Get the mailer class from the mailer reference object.
|
||||||
def self.mailer
|
def self.mailer
|
||||||
if defined?(ActiveSupport::Dependencies::ClassCache)
|
@@mailer_ref.get
|
||||||
@@mailer_ref.get "Devise::Mailer"
|
|
||||||
else
|
|
||||||
@@mailer_ref.get
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Set the mailer reference object to access the mailer.
|
# Set the mailer reference object to access the mailer.
|
||||||
|
|
|
@ -74,11 +74,7 @@ module Devise
|
||||||
|
|
||||||
# Gives the class the mapping points to.
|
# Gives the class the mapping points to.
|
||||||
def to
|
def to
|
||||||
if defined?(ActiveSupport::Dependencies::ClassCache)
|
@ref.get
|
||||||
@ref.get @class_name
|
|
||||||
else
|
|
||||||
@ref.get
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def strategies
|
def strategies
|
||||||
|
|
Loading…
Add table
Reference in a new issue