Method: ROM::Relation::Combined#command
- Defined in:
- lib/rom/relation/combined.rb
#command(type, *args) ⇒ Object
Return a ‘:create` command that can insert data from a nested hash.
This is limited to ‘:create` commands only, because automatic restriction for `:update` commands would be quite complex. It’s possible that in the future support for ‘:update` commands will be added though.
Another limitation is that it can only work when you’re composing parent and its child(ren), which follows canonical hierarchy from your database, so that parents are created first, then their PKs are set as FKs in child tuples. It should be possible to make it work with both directions (parent => child or child => parent), and it would require converting input tuples based on how they depend on each other, which we could do in the future.
Expanding functionality of this method is planned for rom 5.0.
131 132 133 134 135 136 137 |
# File 'lib/rom/relation/combined.rb', line 131 def command(type, *args) if type == :create super else raise NotImplementedError, "#{self.class}#command doesn't work with #{type.inspect} command type yet" end end |