Class: OceanDynamo::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/ocean-dynamo/associations/relation.rb

Overview

Relation is a stripped-down version of the corresponding ActiveRecord class. OceanDynamo doesn’t implement scopes or counter caches, which simplifies the code considerably.

Inheritance chain:

Relation             (@klass, @loaded)
  CollectionProxy    (@association)

Direct Known Subclasses

Associations::CollectionProxy

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Relation

Returns a new instance of Relation.



24
25
26
27
# File 'lib/ocean-dynamo/associations/relation.rb', line 24

def initialize(klass)
  @klass = klass
  @loaded = false
end

Instance Attribute Details

#klassObject (readonly) Also known as: model

Returns the value of attribute klass.



17
18
19
# File 'lib/ocean-dynamo/associations/relation.rb', line 17

def klass
  @klass
end

#loadedObject (readonly) Also known as: loaded?

Returns the value of attribute loaded.



18
19
20
# File 'lib/ocean-dynamo/associations/relation.rb', line 18

def loaded
  @loaded
end

Instance Method Details

#new(*args, &block) ⇒ Object Also known as: build



30
31
32
# File 'lib/ocean-dynamo/associations/relation.rb', line 30

def new(*args, &block)
  @klass.new(*args, &block)
end