Class: ROM::Changeset::Associated
- Inherits:
-
Object
- Object
- ROM::Changeset::Associated
- Extended by:
- Initializer
- Defined in:
- lib/rom/repository/changeset/associated.rb
Overview
Associated changesets automatically set up FKs
Instance Attribute Summary collapse
-
#association ⇒ Symbol
readonly
Association identifier from relation schema.
-
#left ⇒ Changeset::Create
readonly
Child changeset.
-
#right ⇒ Changeset::Create, ...
readonly
Parent changeset or data.
Instance Method Summary collapse
-
#command ⇒ ROM::Command::Composite
Create a composed command.
-
#commit ⇒ Array<Hash>, Hash
Commit changeset’s composite command.
- #relation ⇒ Object private
Instance Attribute Details
#association ⇒ Symbol (readonly)
Returns Association identifier from relation schema.
21 |
# File 'lib/rom/repository/changeset/associated.rb', line 21 option :association, reader: true |
#left ⇒ Changeset::Create (readonly)
Returns Child changeset.
13 |
# File 'lib/rom/repository/changeset/associated.rb', line 13 param :left |
#right ⇒ Changeset::Create, ... (readonly)
Returns Parent changeset or data.
17 |
# File 'lib/rom/repository/changeset/associated.rb', line 17 param :right |
Instance Method Details
#command ⇒ ROM::Command::Composite
Create a composed command
This works only with parent => child(ren) changeset hierarchy
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/rom/repository/changeset/associated.rb', line 59 def command case right when Changeset left.command.curry(left) >> right.command.with_association(association).curry(right) when Associated left.command.curry(left) >> right.command.with_association(association) else left.command.with_association(association).curry(left, right) end end |
#commit ⇒ Array<Hash>, Hash
Commit changeset’s composite command
35 36 37 |
# File 'lib/rom/repository/changeset/associated.rb', line 35 def commit command.call end |
#relation ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
71 72 73 |
# File 'lib/rom/repository/changeset/associated.rb', line 71 def relation left.relation end |