Class: OldApiResource::Associations::RelationScope

Inherits:
Scope
  • Object
show all
Defined in:
lib/old_api_resource/associations/relation_scope.rb

Instance Attribute Summary

Attributes inherited from Scope

#current_scope, #klass, #scopes

Instance Method Summary collapse

Methods inherited from Scope

#initialize, #inspect, #method_missing, #scope?, #to_query, #to_s

Constructor Details

This class inherits a constructor from OldApiResource::Associations::Scope

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class OldApiResource::Associations::Scope

Instance Method Details

#internal_objectObject

Use this method to access the internal data, this guarantees that loading only occurs once per object



16
17
18
# File 'lib/old_api_resource/associations/relation_scope.rb', line 16

def internal_object
  @internal_object ||= self.klass.send(:load_scope_with_options, self.current_scope, self.scopes[self.current_scope])
end

#reloadObject



9
10
11
12
13
# File 'lib/old_api_resource/associations/relation_scope.rb', line 9

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