Method: ApiResource::Associations::HasOneRemoteObjectProxy#internal_object

Defined in:
lib/api_resource/associations/has_one_remote_object_proxy.rb

#internal_objectObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/api_resource/associations/has_one_remote_object_proxy.rb', line 17

def internal_object
  # if we don't have a remote path and we do have and id,
  # we set it before we call the internal object
  # this lets us dynamically generate the correct path
  if self.remote_path.blank? && self.owner.try(:id).present?
    self.remote_path = self.klass.collection_path(
      self.owner.class.to_s.foreign_key => self.owner.id
    )
  end
  super
end