lib/toaster/model/automation_run.rb in cloud-toaster-1.1.5 vs lib/toaster/model/automation_run.rb in cloud-toaster-1.1.6

- old
+ new

@@ -16,12 +16,12 @@ @@current_run = nil belongs_to :user belongs_to :automation - has_many :task_executions, nil, {:autosave => true, :dependent => :delete_all} - has_many :run_attributes, nil, {:autosave => true, :dependent => :delete_all} + has_many :task_executions, :autosave => true, :dependent => :destroy + has_many :run_attributes, :autosave => true, :dependent => :destroy # FIELDS: # :uuid, :machine_id, :automation, :start_time, # :end_time, :success, :error_details, :attributes @@ -82,18 +82,9 @@ end def duration return nil if !end_time || !start_time return end_time - start_time - end - - def self.load(id, automation = nil) - id = DB.instance.wrap_db_id(id) - preset_fields = {} - preset_fields["automation"] = automation if automation - runs = find({"_id" => id}, preset_fields) - return nil if !runs || runs.empty? - return runs[0] end def self.find(criteria={}) DB.find_activerecord(AutomationRun, criteria) end