instance method
create_reflection
Ruby on Rails 4.0.13
Since v2.2.3 Last seen in v4.0.13Signature
create_reflection(macro, name, scope, options, active_record)
No documentation comment.
Parameters
-
macroreq -
namereq -
scopereq -
optionsreq -
active_recordreq
Source
# File activerecord/lib/active_record/reflection.rb, line 20
def create_reflection(macro, name, scope, options, active_record)
case macro
when :has_many, :belongs_to, :has_one, :has_and_belongs_to_many
klass = options[:through] ? ThroughReflection : AssociationReflection
reflection = klass.new(macro, name, scope, options, active_record)
when :composed_of
reflection = AggregateReflection.new(macro, name, scope, options, active_record)
end
self.reflections = self.reflections.merge(name => reflection)
reflection
end
Defined in activerecord/lib/active_record/reflection.rb line 20
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Reflection::ClassMethods