Method: ActiveRecord::Reflection::ClassMethods#normalized_reflections

Defined in:
activerecord/lib/active_record/reflection.rb

#normalized_reflectionsObject

:nodoc:



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'activerecord/lib/active_record/reflection.rb', line 82

def normalized_reflections # :nodoc:
  @__reflections ||= begin
    ref = {}

    _reflections.each do |name, reflection|
      parent_reflection = reflection.parent_reflection

      if parent_reflection
        parent_name = parent_reflection.name
        ref[parent_name] = parent_reflection
      else
        ref[name] = reflection
      end
    end

    ref.freeze
  end
end