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.



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

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

Instance Attribute Details

#klassObject (readonly) Also known as: model

Returns the value of attribute klass.



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

def klass
  @klass
end

#loadedObject (readonly) Also known as: loaded?

Returns the value of attribute loaded.



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

def loaded
  @loaded
end

Instance Method Details

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



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

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