method

normalize_options

rails latest stable - Class: ActiveRecord::Reflection::MacroReflection

Method not available on this version

This method is only available on newer versions. The first available version (v7.2.3) is shown here.

normalize_options(options)
private

No documentation available.

# File activerecord/lib/active_record/reflection.rb, line 465
        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