Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# PUT /audio_clips/1
# PUT /audio_clips/1.json
def update
@audio_clip = AudioClip.find(params[:id])
respond_to do |format|
if @audio_clip.update_attributes(params[:audio_clip])
format.html { redirect_to @audio_clip, notice: 'Audio clip was successfully updated.' }
format.json { render :json => @audio_clip }
else
format.html { render action: "edit" }
format.json { render json: @audio_clip.errors, status: :unprocessable_entity }
end
end
end
#Put Command Sent:
curl -i -H "Accept: application/json" -X PUT -d "like_count=5" http://localhost:3000/audio_clips/25.json
#Response Received
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-UA-Compatible: IE=Edge
ETag: "7ae5757e1b786a3feb1a604a4991df94"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 6c42bd1f05cffb45dc41613afc404e8f
X-Runtime: 0.008259
Connection: close
Server: thin 1.5.0 codename Knife
# JSON Response:
{
"address": null,
"category": null,
"created_at": "2013-02-23T21:27:57Z",
"fsvenue": "",
"id": 25,
"latitude": null,
"like_count": 2,
"longitude": null,
"play_count": 2,
"public": false,
"sound_file": {
"url": null
},
"sound_file_url": null,
"title": "trest",
"updated_at": "2013-02-24T04:06:41Z",
"user_id": null,
"username": "awesome"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.