module ModelOrchestration::Persistence
Including this module will give an OrchestrationModel::Base ActiveRecord-like methods for perstistence. The methods available are restricted to variations of save and create because updating/deleting/finding are usually actions performed on a single record, not an orchestrated meta model.
Public Instance Methods
save(*args)
click to toggle source
See: api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-save
# File lib/model_orchestration/persistence.rb, line 35 def save(*args) @nested_model_instances.each do |key, instance| return false unless instance.save(args) end true end
save!(*args)
click to toggle source
See: api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-save-21
# File lib/model_orchestration/persistence.rb, line 45 def save!(*args) @nested_model_instances.each do |key, instance| instance.save(args) end end