module Torque::PostgreSQL::Associations::Association
Public Instance Methods
inversed_from(record)
click to toggle source
There is no problem of adding temporary items on target because CollectionProxy will handle memory and persisted relationship
Calls superclass method
# File lib/torque/postgresql/associations/association.rb, line 10 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
skip_statement_cache?(*)
click to toggle source
The binds and the cache are getting mixed and caching the wrong query
Calls superclass method
# File lib/torque/postgresql/associations/association.rb, line 19 def skip_statement_cache?(*) super || reflection.connected_through_array? end
Private Instance Methods
set_owner_attributes(record)
click to toggle source
This is mainly for the has many when connect through an array to add its id to the list of the inverse belongs to many association
Calls superclass method
# File lib/torque/postgresql/associations/association.rb, line 27 def set_owner_attributes(record) return super unless reflection.connected_through_array? add_id = owner[reflection.active_record_primary_key] list = record[reflection.foreign_key] ||= [] list.push(add_id) unless list.include?(add_id) end