Sha256: 5955ed55e71d938102541e88d8c3f769f04b6f1f4ee3441c2170f23daee3c4d4

Contents?: true

Size: 461 Bytes

Versions: 2

Compression:

Stored size: 461 Bytes

Contents

require 'api_resource/associations/single_object_proxy'
module ApiResource
  module Associations
    class BelongsToRemoteObjectProxy < SingleObjectProxy
      def initialize(klass, owner)
        super(klass, owner)
        
        # now if we have an owner and a foreign key, we set the data up to load
        if key = owner.send(self.klass.to_s.foreign_key)
          self.remote_path =  self.klass.element_path(key)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
api_resource-0.5.1 lib/api_resource/associations/belongs_to_remote_object_proxy.rb
api_resource-0.5.0 lib/api_resource/associations/belongs_to_remote_object_proxy.rb