Skip to content

Commit

Permalink
Replace update_attributes by update
Browse files Browse the repository at this point in the history
Method update_attributes is deprecated and will be removed from Rails
6.1.
  • Loading branch information
saraycp committed May 6, 2020
1 parent ddd8b1f commit 19ec22b
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/api/app/controllers/configurations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def update
attribs[key] = value
end

ret = @configuration.update_attributes(attribs)
ret = @configuration.update(attribs)
if ret
@configuration.save!
head :ok
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/controllers/issue_trackers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def update

issue_tracker = IssueTracker.find_by_name(params[:id])
if issue_tracker
issue_tracker.update_attributes(attribs)
issue_tracker.update(attribs)
else
IssueTracker.create(attribs)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def update
repository: @download_on_demand.repository,
architecture: Architecture.find_by_name(permitted_params[:arch])
).first_or_create!
@download_on_demand.update_attributes!(permitted_params)
@download_on_demand.update!(permitted_params)
@project.store
end
rescue ActiveRecord::RecordInvalid => e
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/controllers/webui/kiwi/images_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def update
::Kiwi::Image.transaction do
cleanup_non_project_repositories!

@image.update_attributes!(image_params) unless params[:kiwi_image].empty?
@image.update!(image_params) unless params[:kiwi_image].empty?
@image.write_to_backend
end
redirect_to action: :edit
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/controllers/webui/repositories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def follow_change_flag_command(flag_type)
@main_object.flags.of_type(flag_type).where(repo: params[:repository], architecture: architecture).delete_all
elsif %r{^set-(?<status>disable|enable)$} =~ params[:command]
flag = @main_object.flags.find_or_create_by(flag: flag_type, repo: params[:repository], architecture: architecture)
flag.update_attributes(status: status)
flag.update(status: status)
end
@main_object.store
end
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/jobs/send_event_emails_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ def send_email(subscribers, event)
rescue StandardError => e
Airbrake.notify(e, event_id: event.id)
ensure
event.update_attributes(mails_sent: true)
event.update(mails_sent: true)
end
end
2 changes: 1 addition & 1 deletion src/api/app/models/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def update_from_options_yml
unless CONFIG['frontend_host'].blank? || CONFIG['frontend_port'].blank? || CONFIG['frontend_protocol'].blank?
attribs['api_url'] = "#{CONFIG['frontend_protocol']}://#{CONFIG['frontend_host']}:#{CONFIG['frontend_port']}"
end
update_attributes(attribs)
update(attribs)
save!
end

Expand Down
6 changes: 3 additions & 3 deletions src/api/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def authenticate(unencrypted_password)
# the password to a bcrypt one
if deprecated_password
if deprecated_password_equals?(unencrypted_password)
update_attributes(password: unencrypted_password, deprecated_password: nil, deprecated_password_salt: nil, deprecated_password_hash_type: nil)
update(password: unencrypted_password, deprecated_password: nil, deprecated_password_salt: nil, deprecated_password_hash_type: nil)
return self
end

Expand Down Expand Up @@ -867,11 +867,11 @@ def combined_rss_feed_items
end

def mark_login!
update_attributes(last_logged_in_at: Time.zone.today, login_failure_count: 0)
update(last_logged_in_at: Time.zone.today, login_failure_count: 0)
end

def count_login_failure
update_attributes(login_failure_count: login_failure_count + 1)
update(login_failure_count: login_failure_count + 1)
end

def proxy_realname(env)
Expand Down

0 comments on commit 19ec22b

Please sign in to comment.