Replace deprecated update_attributes with update.

https://rubyinrails.com/2019/04/09/rails-6-1-activerecord-deprecates-update-attributes-methods/

DEPRECATION WARNING: update_attributes! is deprecated and will be removed from Rails 6.1 (please, use update! instead)
This commit is contained in:
evazion
2019-08-25 20:29:32 -05:00
parent 62875eabb2
commit 0df5c0fd2b
23 changed files with 63 additions and 87 deletions

View File

@@ -47,7 +47,7 @@ class UserNameChangeRequest < ApplicationRecord
end
def approve!
update_attributes(:status => "approved", :approver_id => CurrentUser.user.id)
update(status: "approved", approver_id: CurrentUser.user.id)
user.update_attribute(:name, desired_name)
body = "Your name change request has been approved. Be sure to log in with your new user name."
Dmail.create_automated(:title => "Name change request approved", :body => body, :to_id => user_id)
@@ -56,7 +56,7 @@ class UserNameChangeRequest < ApplicationRecord
end
def reject!(reason)
update_attributes(:status => "rejected", :rejection_reason => reason)
update(status: "rejected", rejection_reason: reason)
body = "Your name change request has been rejected for the following reason: #{rejection_reason}"
Dmail.create_automated(:title => "Name change request rejected", :body => body, :to_id => user_id)
end