Sha256: 65ac3fa64b88342db3d1896dc823c26cfd14ddfe5b7b082c930b4afe2bf7dfb4

Contents?: true

Size: 754 Bytes

Versions: 2

Compression:

Stored size: 754 Bytes

Contents

require 'api_resource/associations/scope'

module ApiResource
  
  module Associations
    
    class RelationScope < Scope

      def reload
        remove_instance_variable(:@internal_object) if instance_variable_defined?(:@internal_object)
        self.klass.reload(self.current_scope, self.scopes[self.current_scope])
        self
      end

      # Use this method to access the internal data, this guarantees that loading only occurs once per object
      def internal_object
        @internal_object ||= self.klass.send(:load_scope_with_options, self.current_scope, self.to_hash)
      end
      
      # 
      # class factory
      def self.class_factory(hsh)
        ApiResource::Associations::RelationScope
      end

    end
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
api_resource-0.2.2 lib/api_resource/associations/relation_scope.rb
api_resource-0.2.1 lib/api_resource/associations/relation_scope.rb