Module: InverseOf::Associations::ClassMethods::JoinDependency

Defined in:
lib/inverse_of.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



229
230
231
# File 'lib/inverse_of.rb', line 229

def self.included(base)
  base.alias_method_chain :construct_association, :inverse_of
end

Instance Method Details

#construct_association_with_inverse_of(record, join, row) ⇒ Object



233
234
235
236
237
238
239
# File 'lib/inverse_of.rb', line 233

def construct_association_with_inverse_of(record, join, row)
  association = construct_association_without_inverse_of(record, join, row) or
    return nil
  association_proxy = record.send(join.reflection.name)
  association_proxy.__send__(:set_inverse_instance, association, record)
  return association
end