method
create
v5.0.0.1 -
Show latest stable
- Class:
ActiveRecord::Reflection
create(macro, name, scope, options, ar)public
No documentation available.
# File activerecord/lib/active_record/reflection.rb, line 16
def self.create(macro, name, scope, options, ar)
klass = case macro
when :composed_of
AggregateReflection
when :has_many
HasManyReflection
when :has_one
HasOneReflection
when :belongs_to
BelongsToReflection
else
raise "Unsupported Macro: #{macro}"
end
reflection = klass.new(name, scope, options, ar)
options[:through] ? ThroughReflection.new(reflection) : reflection
end