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.
24 25 26 27 |
# File 'lib/ocean-dynamo/associations/relation.rb', line 24 def initialize(klass) @klass = klass @loaded = false end |
Instance Attribute Details
#klass ⇒ Object (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 |
#loaded ⇒ Object (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 |