Skip to content

Commit

Permalink
updates: use update instead of update_attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
moray95 authored and MaicolBen committed Aug 10, 2019
1 parent bc4b65c commit 52b36b8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/devise_token_auth/passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def update
def resource_update_method
allow_password_change = recoverable_enabled? && @resource.allow_password_change == true
if DeviseTokenAuth.check_current_password_before_update == false || allow_password_change
'update_attributes'
'update'
else
'update_with_password'
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def resource_update_method
elsif account_update_params.key?(:current_password)
'update_with_password'
else
'update_attributes'
'update'
end
end

Expand Down
4 changes: 2 additions & 2 deletions test/controllers/demo_user_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ class DemoUserControllerTest < ActionDispatch::IntegrationTest
assert @resource.tokens.count > 1

# password changed from new device
@resource.update_attributes(password: 'newsecret123',
password_confirmation: 'newsecret123')
@resource.update(password: 'newsecret123',
password_confirmation: 'newsecret123')

get '/demo/members_only',
params: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class RegistrationsController < DeviseTokenAuth::RegistrationsController

def update
if @resource
if @resource.update_attributes(account_update_params)
if @resource.update(account_update_params)
render json: {
status: 'success',
data: @resource.as_json,
Expand Down

0 comments on commit 52b36b8

Please sign in to comment.