instance method
reflections
Ruby on Rails 4.2.9
Since v2.2.3Signature
reflections()
Returns a Hash of name of the reflection as the key and a AssociationReflection as the value.
Account.reflections # => {"balance" => AggregateReflection}
@api public
Source
# File activerecord/lib/active_record/reflection.rb, line 70
def reflections
@__reflections ||= begin
ref = {}
_reflections.each do |name, reflection|
parent_name, parent_reflection = reflection.parent_reflection
if parent_name
ref[parent_name] = parent_reflection
else
ref[name] = reflection
end
end
ref
end
end
Defined in activerecord/lib/active_record/reflection.rb line 70
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Reflection::ClassMethods