Class: ApiResource::Associations::ResourceScope

Inherits:
Scope
  • Object
show all
Includes:
Enumerable
Defined in:
lib/api_resource/associations.rb

Instance Attribute Summary

Attributes inherited from Scope

#current_scope, #klass, #scopes

Instance Method Summary collapse

Methods inherited from Scope

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

Constructor Details

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

Dynamic Method Handling

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

Instance Method Details

#each(*args, &block) ⇒ Object



271
272
273
# File 'lib/api_resource/associations.rb', line 271

def each(*args, &block)
  self.internal_object.each(*args, &block)
end

#internal_objectObject Also known as: all



265
266
267
# File 'lib/api_resource/associations.rb', line 265

def internal_object
  @internal_object ||= self.klass.send(:find, :all, :params => self.scopes[self.current_scope])
end