class ActiveRecord::AssociationRelation - activerecord-4.2.3 Documentation

# class ActiveRecord::AssociationRelation

### Public Class Methods

new(klass, table, association) click to toggle source
Calls superclass method

    # File lib/active_record/association_relation.rb, line 3
    def initialize(klass, table, association)
      super(klass, table)
      @association = association
    end

### Public Instance Methods

==(other) click to toggle source

    # File lib/active_record/association_relation.rb, line 12
    def ==(other)
      other == to_a
    end

build(*args, &block) click to toggle source

    # File lib/active_record/association_relation.rb, line 16
    def build(*args, &block)
      scoping { @association.build(*args, &block) }
    end

Also aliased as: new
create(*args, &block) click to toggle source

    # File lib/active_record/association_relation.rb, line 21
    def create(*args, &block)
      scoping { @association.create(*args, &block) }
    end

create!(*args, &block) click to toggle source

    # File lib/active_record/association_relation.rb, line 25
    def create!(*args, &block)
      scoping { @association.create!(*args, &block) }
    end

new(*args, &block)
Alias for: build
proxy_association() click to toggle source

    # File lib/active_record/association_relation.rb, line 8
    def proxy_association
      @association
    end

### Private Instance Methods

exec_queries() click to toggle source
Calls superclass method

    # File lib/active_record/association_relation.rb, line 31
    def exec_queries
      super.each { |r| @association.set_inverse_instance r }
    end