class ActiveForce::Association::BelongsToAssociation
Private Instance Methods
default_foreign_key()
click to toggle source
# File lib/active_force/association/belongs_to_association.rb, line 6 def default_foreign_key infer_foreign_key_from_model relation_model end
define_relation_method()
click to toggle source
# File lib/active_force/association/belongs_to_association.rb, line 10 def define_relation_method association = self _method = @relation_name @parent.send :define_method, _method do association_cache.fetch(_method) do association_cache[_method] = association.relation_model.find(send association.foreign_key) end end @parent.send :define_method, "#{_method}=" do |other| send "#{ association.foreign_key }=", other.nil? ? nil : other.id association_cache[_method] = other end end