lib/tengine/job/vertex.rb in tengine_job-0.6.13 vs lib/tengine/job/vertex.rb in tengine_job-1.1.0
- old
+ new
@@ -10,10 +10,19 @@
include Tengine::Job::NamePath
self.cyclic = true
with_options(:class_name => self.name, :cyclic => true) do |c|
c.embedded_in :parent , :inverse_of => :children
- c.embeds_many :children, :inverse_of => :parent
+ c.embeds_many :children, :inverse_of => :parent , :validate => false
+ end
+
+ before_validation do |r|
+ r.children.each do |child|
+ child.valid?
+ child.errors.each do |f, error|
+ r.errors.add(:base, error)
+ end
+ end
end
# def short_inspect
# "#<%%%-30s id: %s>" % [self.class.name, self.id.to_s]
# end