-
-
Save dnagir/9ca5dce0524927d69655 to your computer and use it in GitHub Desktop.
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
class @User extends ko.Model | |
@persistAt 'user' | |
@fields 'id', 'name', 'email', 'validateRemotely' | |
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
class UsersController < ApplicationController | |
def update | |
@user = User.find params[:id] | |
@user.attributes = params[:user] | |
if @user.valid? | |
@user.save! unless params[:user][:validateRemotely] | |
render :json => @user, :status => 200 | |
else | |
render :json => @user.errors, :status => 422 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment