Sha256: d908e9a217c693fb374f43421e0ff61c3ba42302f5607e42dba6ccc82ffe4be9
Contents?: true
Size: 788 Bytes
Versions: 33
Compression:
Stored size: 788 Bytes
Contents
# frozen_string_literal: true module ActiveRecord class AssociationRelation < Relation def initialize(klass, association) super(klass) @association = association end def proxy_association @association end def ==(other) other == records end def build(*args, &block) scoping { @association.build(*args, &block) } end alias new build def create(*args, &block) scoping { @association.create(*args, &block) } end def create!(*args, &block) scoping { @association.create!(*args, &block) } end private def exec_queries super do |record| @association.set_inverse_instance_from_queries(record) yield record if block_given? end end end end
Version data entries
33 entries across 33 versions & 4 rubygems