Class: OceanDynamo::Relation
- Inherits:
-
Object
- Object
- OceanDynamo::Relation
- 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
Instance Attribute Summary collapse
-
#klass ⇒ Object
(also: #model)
readonly
Returns the value of attribute klass.
-
#loaded ⇒ Object
(also: #loaded?)
readonly
Returns the value of attribute loaded.
Instance Method Summary collapse
-
#initialize(klass) ⇒ Relation
constructor
A new instance of Relation.
- #new(*args, &block) ⇒ Object (also: #build)
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
#klass ⇒ Object (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 |
#loaded ⇒ Object (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 |