Skip to content

Instantly share code, notes, and snippets.

@abigoroth
Created May 9, 2012 10:25
Show Gist options
  • Save abigoroth/2643597 to your computer and use it in GitHub Desktop.
Save abigoroth/2643597 to your computer and use it in GitHub Desktop.
backbone update attributes return 204 instead of 422
#in my controller
def update
user = current_user.update_attributes(params[:user])
respond_with user
end
#in my backbone view
@model.url = '/api/users'
attributes =
name: $("#user_name").val()
country: $("#user_country").val()
timezone: $("#user_timezone").val()
url: $("#user_url").val()
@model.save attributes,
wait: true
success: =>
show_notice("Profile Saved.")
$(".profile_form").modal("hide")
console.log "submit success"
console.log @model
upView = new Dnscell.Views.user_profile(model: @model)
$(".content_inside").html(upView.render().el)
error: @handleError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment