Class: Djoini::Relation
- Inherits:
-
Object
- Object
- Djoini::Relation
- Includes:
- Composable
- Defined in:
- lib/djoini/relation.rb
Overview
Hold creation of new records(rowsobjects)
Instance Attribute Summary collapse
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(params) ⇒ Relation
constructor
A new instance of Relation.
- #new_record(values) ⇒ Object
Methods included from Composable
#features, #method_missing, #respond_to_missing?
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Djoini::Composable
Instance Attribute Details
#table ⇒ Object
Returns the value of attribute table.
18 19 20 |
# File 'lib/djoini/relation.rb', line 18 def table @table end |
Instance Method Details
#attributes ⇒ Object
20 21 22 |
# File 'lib/djoini/relation.rb', line 20 def attributes table.columns.keys end |
#new_record(values) ⇒ Object
24 25 26 27 28 |
# File 'lib/djoini/relation.rb', line 24 def new_record(values) record_class.new(relation: self, values: values, key: values[table.primary_key]) end |