diff --git a/lib/devise.rb b/lib/devise.rb index 9fc667a6..b9d2bb05 100644 --- a/lib/devise.rb +++ b/lib/devise.rb @@ -226,6 +226,12 @@ module Devise yield self end + def self.ref(arg) + dependencies = ActiveSupport::Dependencies + dependencies.respond_to?(:reference) ? + dependencies.reference(arg) : dependencies.ref(arg) + end + def self.omniauth_providers omniauth_configs.keys end @@ -243,9 +249,7 @@ module Devise # Set the mailer reference object to access the mailer. def self.mailer=(class_name) - @@mailer_ref = ActiveSupport::Dependencies.respond_to?(:reference) - ? ActiveSupport::Dependencies.reference(class_name) - : ActiveSupport::Dependencies.ref(class_name) + @@mailer_ref = ref(class_name) end self.mailer = "Devise::Mailer" diff --git a/lib/devise/mapping.rb b/lib/devise/mapping.rb index 8a1d25ff..3f6d275e 100644 --- a/lib/devise/mapping.rb +++ b/lib/devise/mapping.rb @@ -50,7 +50,7 @@ module Devise @singular = (options[:singular] || @scoped_path.tr('/', '_').singularize).to_sym @class_name = (options[:class_name] || name.to_s.classify).to_s - @ref = ActiveSupport::Dependencies.ref(@class_name) + @ref = Devise.ref(@class_name) @path = (options[:path] || name).to_s @path_prefix = options[:path_prefix]