Skip to content

Commit f39244e

Browse files
moray95MaicolBen
authored andcommitted
updates: use update instead of update_attributes (#1314)
1 parent bc4b65c commit f39244e

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

app/controllers/devise_token_auth/passwords_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def update
9292
def resource_update_method
9393
allow_password_change = recoverable_enabled? && @resource.allow_password_change == true
9494
if DeviseTokenAuth.check_current_password_before_update == false || allow_password_change
95-
'update_attributes'
95+
'update'
9696
else
9797
'update_with_password'
9898
end

app/controllers/devise_token_auth/registrations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def resource_update_method
181181
elsif account_update_params.key?(:current_password)
182182
'update_with_password'
183183
else
184-
'update_attributes'
184+
'update'
185185
end
186186
end
187187

test/controllers/demo_user_controller_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ class DemoUserControllerTest < ActionDispatch::IntegrationTest
321321
assert @resource.tokens.count > 1
322322

323323
# password changed from new device
324-
@resource.update_attributes(password: 'newsecret123',
325-
password_confirmation: 'newsecret123')
324+
@resource.update(password: 'newsecret123',
325+
password_confirmation: 'newsecret123')
326326

327327
get '/demo/members_only',
328328
params: {},

test/dummy/app/controllers/overrides/registrations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class RegistrationsController < DeviseTokenAuth::RegistrationsController
66

77
def update
88
if @resource
9-
if @resource.update_attributes(account_update_params)
9+
if @resource.update(account_update_params)
1010
render json: {
1111
status: 'success',
1212
data: @resource.as_json,

0 commit comments

Comments
 (0)