Class: Actions::Staypuft::Host::Update

Inherits:
Dynflow::Action
  • Object
show all
Defined in:
app/lib/actions/staypuft/host/update.rb

Instance Method Summary collapse

Instance Method Details

#plan(host, updates) ⇒ Object



20
21
22
# File 'app/lib/actions/staypuft/host/update.rb', line 20

def plan(host, updates)
  plan_self host_id: host.id, updates: updates
end

#runObject



24
25
26
27
28
29
# File 'app/lib/actions/staypuft/host/update.rb', line 24

def run
  host = ::Host.find(input.fetch :host_id)
  host.update_attributes input.fetch(:updates)
  output.update changing: host.changes
  host.save!
end