Created
May 9, 2012 10:25
-
-
Save abigoroth/2643597 to your computer and use it in GitHub Desktop.
backbone update attributes return 204 instead of 422
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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