method
normalize_options
v8.0.0 -
Show latest stable
- Class:
ActiveRecord::Reflection::MacroReflection
normalize_options(options)private
No documentation available.
# File activerecord/lib/active_record/reflection.rb, line 457
def normalize_options(options)
counter_cache = options.delete(:counter_cache)
if counter_cache
active = true
case counter_cache
when String, Symbol
column = -counter_cache.to_s
when Hash
active = counter_cache.fetch(:active, true)
column = counter_cache[:column]&.to_s
end
options[:counter_cache] = { active: active, column: column }
end
options
end