Sha256: 139bbb7f5b69608ec63df33b2cc437779fe306b8f16e062a8cf54d9f6095a660
Contents?: true
Size: 906 Bytes
Versions: 1
Compression:
Stored size: 906 Bytes
Contents
# frozen_string_literal: true module Torque module PostgreSQL module Associations module Association def inversed_from(record) return super unless reflection.connected_through_array? self.target ||= [] self.target.push(record) unless self.target.include?(record) @inversed = self.target.present? end private def set_owner_attributes(record) return super unless reflection.connected_through_array? add_id = owner[reflection.active_record_primary_key] record_fk = reflection.foreign_key list = record[record_fk] ||= [] list.push(add_id) unless list.include?(add_id) end end ::ActiveRecord::Associations::Association.prepend(Association) ::ActiveRecord::Associations::HasManyAssociation.prepend(Association) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
torque-postgresql-2.0.4 | lib/torque/postgresql/associations/association.rb |