Class: Bosh::Director::Models::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/models/task.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_with_teams(attributes) ⇒ Object



11
12
13
14
15
16
# File 'lib/bosh/director/models/task.rb', line 11

def self.create_with_teams(attributes)
  teams = attributes.delete(:teams)
  task = create(attributes)
  task.teams = teams
  task
end

Instance Method Details

#teams=(teams) ⇒ Object



18
19
20
21
22
# File 'lib/bosh/director/models/task.rb', line 18

def teams=(teams)
  (teams || []).each do |t|
    self.add_team(t)
  end
end

#validateObject



7
8
9
# File 'lib/bosh/director/models/task.rb', line 7

def validate
  validates_presence [:state, :timestamp, :description]
end