Class: Yogo::Collection::Relationship::ManyToOne

Inherits:
Yogo::Collection::Relationship show all
Defined in:
lib/yogo/collection/property.rb

Constant Summary

Constants inherited from Property

Property::COMMON_PROPERTIES

Instance Method Summary collapse

Methods inherited from Yogo::Collection::Relationship

#as_json, #check_target, #target_model

Methods inherited from Property

#as_json, #field_name, #to_s, #update_attributes

Instance Method Details

#add_to_model(model) ⇒ Object



119
120
121
122
# File 'lib/yogo/collection/property.rb', line 119

def add_to_model(model)
  check_target
  model.send(model_method, ActiveSupport::Inflector.underscore(self.target).intern, options.merge(self.options))
end

#model_methodObject



115
116
117
# File 'lib/yogo/collection/property.rb', line 115

def model_method
  :belongs_to
end