instance method normalize_options

Ruby on Rails 7.2.3

Since v7.2.3 Private

Available in: v7.2.3 v8.0.4 v8.1.2

Signature

normalize_options(options)

No documentation comment.

Parameters

options req
Source
# 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

Defined in activerecord/lib/active_record/reflection.rb line 465 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Reflection::MacroReflection

Type at least 2 characters to search.

↑↓ navigate · open · esc close