Skip to content

Instantly share code, notes, and snippets.

@bretdavidson
Created June 30, 2016 17:55
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 bretdavidson/f3f0e7fa80daa0ab1d85794f54433076 to your computer and use it in GitHub Desktop.
Save bretdavidson/f3f0e7fa80daa0ab1d85794f54433076 to your computer and use it in GitHub Desktop.
def update
@computer = Computer.find_by mac_address: params[:id]
if @computer
if @computer.update_attributes(:status => params[:status])
render json: {:message => 'Computer Updated'}, status: 200
else
render json: {:errors => @computer.errors.full_messages}, status: 422
end
else
render json: {:message => 'Computer Not Found'}, status: 404
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment