Skip to content

Instantly share code, notes, and snippets.

@asterite
Created August 3, 2019 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asterite/791d7d186265c74e1d6d19cc211f4cda to your computer and use it in GitHub Desktop.
Save asterite/791d7d186265c74e1d6d19cc211f4cda to your computer and use it in GitHub Desktop.
def reset
user = current_user
return unless user
user_id = user.id
return unless user_id
server = VirtualMachine.find_by(user_id: user_id, id: params[:server_id])
return unless server
service = Service.find_by(id: server.service_id)
return unless service
return if service.service_is_read_only
server.reset_vm
flash[:info] = "Server reset!!"
redirect_to "/"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment