lib/flapjack/persistence/data_mapper/models/check.rb in flapjack-0.5.5 vs lib/flapjack/persistence/data_mapper/models/check.rb in flapjack-0.6.23
- old
+ new
@@ -1,16 +1,18 @@
+#!/usr/bin/env ruby
+
class Check
include DataMapper::Resource
timestamps :at
has n, :related_checks, :child_key => [:child_id, :parent_id]
has n, :events
- #has n, :parent_checks, :through => :related_checks,
+ #has n, :parent_checks, :through => :related_checks,
# :child_key => :child_id, :class_name => "Check"
- #has n, :child_checks, :through => :related_checks,
+ #has n, :child_checks, :through => :related_checks,
# :child_key => :parent_id, :class_name => "Check"
belongs_to :node
belongs_to :check_template
@@ -25,10 +27,10 @@
property :created_at, DateTime
property :updated_at, DateTime
property :deleted_at, ParanoidDateTime
# copy command onto check
- before :valid? do
+ before :valid? do
if self.check_template && self.command.blank?
self.command = self.check_template.command
self.name = self.check_template.name
self.params = (self.check_template.params || {})
end