instance method create_reflection

Ruby on Rails 3.1.12

Since v2.2.3 Last seen in v4.0.13

Available in: v2.2.3 v2.3.18 v3.0.20 v3.1.12 v3.2.22.5 v4.0.13

Signature

create_reflection(macro, name, options, active_record)

No documentation comment.

Parameters

macro req
name req
options req
active_record req
Source
# File activerecord/lib/active_record/reflection.rb, line 24
      def create_reflection(macro, name, 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, options, active_record)
          when :composed_of
            reflection = AggregateReflection.new(macro, name, options, active_record)
        end

        self.reflections = self.reflections.merge(name => reflection)
        reflection
      end

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

Defined in ActiveRecord::Reflection::ClassMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close