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:
parent
bb879f7154
commit
8593801130
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue