mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-09 14:58:05 -05:00
Keep the constantize behavior consistent for versions prior to Rails 7
Use `AS::Dependencies` as before if we still can, otherwise use the new direct `constantize` call for Rails 7+. Leave a TODO to help remind us this can be removed once we drop support to Rails versions prior to 7 in the future.
This commit is contained in:
@@ -313,11 +313,17 @@ module Devise
|
||||
end
|
||||
|
||||
def get
|
||||
@name.constantize
|
||||
# TODO: Remove AS::Dependencies usage when dropping support to Rails < 7.
|
||||
if ActiveSupport::Dependencies.respond_to?(:constantize)
|
||||
ActiveSupport::Dependencies.constantize(@name)
|
||||
else
|
||||
@name.constantize
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.ref(arg)
|
||||
# TODO: Remove AS::Dependencies usage when dropping support to Rails < 7.
|
||||
if ActiveSupport::Dependencies.respond_to?(:reference)
|
||||
ActiveSupport::Dependencies.reference(arg)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user