Skip to content

Instantly share code, notes, and snippets.

@washingtonsoares
Created November 12, 2014 14:41
Show Gist options
  • Save washingtonsoares/f967bfdfa386002065c9 to your computer and use it in GitHub Desktop.
Save washingtonsoares/f967bfdfa386002065c9 to your computer and use it in GitHub Desktop.
# PATCH/PUT /users/:id.:format
def update
# authorize! :update, @user
respond_to do |format|
if @user.update(user_params)
sign_in(@user == current_user ? @user : current_user, :bypass => true)
format.html { redirect_to @user, notice: 'Your profile was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment