Sha256: 30e01a7ba084a5d8c94ba8f72026d066ebb0b617ac4d3c182e2f82150442cbde

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

require 'old_api_resource/associations/scope'

module OldApiResource
  
  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.scopes[self.current_scope])
      end

    end
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
old_api_resource-0.3.0 lib/old_api_resource/associations/relation_scope.rb