method
convert_key
rails latest stable - Class:
Rails::Application::NonSymbolAccessDeprecatedHash
convert_key(key)public
No documentation available.
# File railties/lib/rails/application.rb, line 628
def convert_key(key)
unless key.kind_of?(Symbol)
ActiveSupport::Deprecation.warn(<<~MESSAGE.squish)
Accessing hashes returned from config_for by non-symbol keys
is deprecated and will be removed in Rails 6.1.
Use symbols for access instead.
MESSAGE
key = key.to_sym
end
key
end
def convert_value(value, options = {}) # :doc:
if value.is_a? Hash
if options[:for] == :to_hash
value.to_hash
else
self.class.new(value)
end
elsif value.is_a?(Array)
if options[:for] != :assignment || value.frozen?
value = value.dup
end
value.map! { |e| convert_value(e, options) }
else
value
end
end
end