app/models/foreman_tasks/task.rb in foreman-tasks-0.6.9 vs app/models/foreman_tasks/task.rb in foreman-tasks-0.6.10
- old
+ new
@@ -6,9 +6,11 @@
# TODO missing validation of states
self.primary_key = :id
before_create :generate_id
+ belongs_to :parent_task, :class_name => 'ForemanTasks::Task'
+ has_many :sub_tasks, :class_name => 'ForemanTasks::Task', :foreign_key => :parent_task_id
has_many :locks
# in fact, the task has only one owner but Rails don't let you to
# specify has_one relation though has_many relation
has_many :owners, :through => :locks, :source => :resource, :source_type => 'User'