From 63939c121e656075296808fd2627cab5a0352ba3 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Fri, 13 Oct 2023 10:59:13 -0300 Subject: [PATCH] Remove deprecated options argument from update methods They were added to support an old/deprecated feature of Rails, as the message was saying, we can now remove them from the code as well. --- lib/devise/models/database_authenticatable.rb | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/lib/devise/models/database_authenticatable.rb b/lib/devise/models/database_authenticatable.rb index 8903e6d06..e16b7d845 100644 --- a/lib/devise/models/database_authenticatable.rb +++ b/lib/devise/models/database_authenticatable.rb @@ -84,16 +84,7 @@ def clean_up_passwords # users to change relevant information like the e-mail without changing # their password). In case the password field is rejected, the confirmation # is also rejected as long as it is also blank. - def update_with_password(params, *options) - if options.present? - Devise.deprecator.warn <<-DEPRECATION.strip_heredoc - [Devise] The second argument of `DatabaseAuthenticatable#update_with_password` - (`options`) is deprecated and it will be removed in the next major version. - It was added to support a feature deprecated in Rails 4, so you can safely remove it - from your code. - DEPRECATION - end - + def update_with_password(params) current_password = params.delete(:current_password) if params[:password].blank? @@ -102,9 +93,9 @@ def update_with_password(params, *options) end result = if valid_password?(current_password) - update(params, *options) + update(params) else - assign_attributes(params, *options) + assign_attributes(params) valid? errors.add(:current_password, current_password.blank? ? :blank : :invalid) false @@ -121,25 +112,16 @@ def update_with_password(params, *options) # # Example: # - # def update_without_password(params, *options) + # def update_without_password(params) # params.delete(:email) # super(params) # end # - def update_without_password(params, *options) - if options.present? - Devise.deprecator.warn <<-DEPRECATION.strip_heredoc - [Devise] The second argument of `DatabaseAuthenticatable#update_without_password` - (`options`) is deprecated and it will be removed in the next major version. - It was added to support a feature deprecated in Rails 4, so you can safely remove it - from your code. - DEPRECATION - end - + def update_without_password(params) params.delete(:password) params.delete(:password_confirmation) - result = update(params, *options) + result = update(params) clean_up_passwords result end