Created
August 13, 2014 14:46
-
-
Save jojo89/4bad23c09e02334306f8 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
def update | |
attributes = params[:client].slice(:username, :email, :password, :pinning_enabled, :engagement_enabled, :total_pins_per_day, :percent_selfie_pins) | |
attributes[:ip_address] = request.remote_addr | |
attributes[:user_agent] = request.user_agent | |
attributes.delete("password") if attributes[:password].blank? | |
@client.changing_credentials = true | |
if @client.require_background_task_for_update? attributes | |
respond_with_json_api_item @client.create_background_task_for_update(attributes) | |
elsif @client.update_attributes attributes, without_protection: true | |
respond_with_json_api_item @client | |
else | |
respond_with_json_api_item_errors @client | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment