Log In
Log In
Places
All Projects
Status Monitor
Collapse sidebar
obs:server:fedora:2.10:testing
obs-server
obs-server-2.10-0125-Replace-update_attributes-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File obs-server-2.10-0125-Replace-update_attributes-by-update.patch of Package obs-server
From e183980739335b986b01c1c5e2e7116a1aa82b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saray=20Cabrera=20Padr=C3=B3n?= <scabrerapadron@suse.de> Date: Wed, 6 May 2020 18:31:45 +0200 Subject: [PATCH] Replace update_attributes by update Method update_attributes is deprecated and will be removed from Rails 6.1. --- src/api/app/controllers/configurations_controller.rb | 2 +- src/api/app/controllers/issue_trackers_controller.rb | 4 ++-- .../app/controllers/webui/download_on_demand_controller.rb | 2 +- src/api/app/controllers/webui/kiwi/images_controller.rb | 2 +- src/api/app/controllers/webui/repositories_controller.rb | 2 +- src/api/app/jobs/send_event_emails_job.rb | 4 ++-- src/api/app/models/configuration.rb | 2 +- src/api/app/models/user.rb | 6 +++--- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/api/app/controllers/configurations_controller.rb b/src/api/app/controllers/configurations_controller.rb index 149d8321b1..12307ae68a 100644 --- a/src/api/app/controllers/configurations_controller.rb +++ b/src/api/app/controllers/configurations_controller.rb @@ -59,7 +59,7 @@ class ConfigurationsController < ApplicationController attribs[key] = value end - ret = @configuration.update_attributes(attribs) + ret = @configuration.update(attribs) if ret @configuration.save! head :ok diff --git a/src/api/app/controllers/issue_trackers_controller.rb b/src/api/app/controllers/issue_trackers_controller.rb index 6ec4f7f469..dba3d96d70 100644 --- a/src/api/app/controllers/issue_trackers_controller.rb +++ b/src/api/app/controllers/issue_trackers_controller.rb @@ -75,7 +75,7 @@ class IssueTrackersController < ApplicationController respond_to do |format| begin - ret = @issue_tracker.update_attributes(request.request_parameters) + ret = @issue_tracker.update(request.request_parameters) rescue ActiveRecord::UnknownAttributeError, ActiveModel::MassAssignmentSecurity::Error # User didn't really upload www-form-urlencoded data but raw XML, try to parse that xml = Nokogiri::XML(request.raw_post, &:strict).root @@ -90,7 +90,7 @@ class IssueTrackersController < ApplicationController attribs[:label] = xml.xpath('label[1]/text()').to_s unless xml.xpath('label[1]/text()').empty? attribs[:enable_fetch] = xml.xpath('enable-fetch[1]/text()').to_s unless xml.xpath('enable-fetch[1]/text()').empty? attribs[:show_url] = xml.xpath('show-url[1]/text()').to_s unless xml.xpath('show-url[1]/text()').empty? - ret = @issue_tracker.update_attributes(attribs) + ret = @issue_tracker.update(attribs) end if ret format.xml { head :ok } diff --git a/src/api/app/controllers/webui/download_on_demand_controller.rb b/src/api/app/controllers/webui/download_on_demand_controller.rb index 86525650f8..36e0bcc488 100644 --- a/src/api/app/controllers/webui/download_on_demand_controller.rb +++ b/src/api/app/controllers/webui/download_on_demand_controller.rb @@ -32,7 +32,7 @@ class Webui::DownloadOnDemandController < Webui::WebuiController 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 diff --git a/src/api/app/controllers/webui/kiwi/images_controller.rb b/src/api/app/controllers/webui/kiwi/images_controller.rb index 5cd04fce7f..7d7e0078f3 100644 --- a/src/api/app/controllers/webui/kiwi/images_controller.rb +++ b/src/api/app/controllers/webui/kiwi/images_controller.rb @@ -74,7 +74,7 @@ module Webui ::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 diff --git a/src/api/app/controllers/webui/repositories_controller.rb b/src/api/app/controllers/webui/repositories_controller.rb index aad7b75fc6..385f9c767b 100644 --- a/src/api/app/controllers/webui/repositories_controller.rb +++ b/src/api/app/controllers/webui/repositories_controller.rb @@ -280,7 +280,7 @@ class Webui::RepositoriesController < Webui::WebuiController @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 diff --git a/src/api/app/jobs/send_event_emails_job.rb b/src/api/app/jobs/send_event_emails_job.rb index 52ac3165b4..b5e269e1d8 100644 --- a/src/api/app/jobs/send_event_emails_job.rb +++ b/src/api/app/jobs/send_event_emails_job.rb @@ -6,7 +6,7 @@ class SendEventEmailsJob < ApplicationJob subscribers = event.subscribers if subscribers.empty? - event.update_attributes(mails_sent: true) + event.update(mails_sent: true) next end @@ -16,7 +16,7 @@ class SendEventEmailsJob < ApplicationJob rescue StandardError => e Airbrake.notify(e, event_id: event.id) ensure - event.update_attributes(mails_sent: true) + event.update(mails_sent: true) end end true diff --git a/src/api/app/models/configuration.rb b/src/api/app/models/configuration.rb index 4a006cc9ca..d0cfad5410 100644 --- a/src/api/app/models/configuration.rb +++ b/src/api/app/models/configuration.rb @@ -115,7 +115,7 @@ class Configuration < ApplicationRecord 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 diff --git a/src/api/app/models/user.rb b/src/api/app/models/user.rb index e545dcbf6b..4588f71bf0 100644 --- a/src/api/app/models/user.rb +++ b/src/api/app/models/user.rb @@ -274,7 +274,7 @@ class User < ApplicationRecord mark_login! self else - update_attributes!(login_failure_count: login_failure_count + 1) + update!(login_failure_count: login_failure_count + 1) nil end end @@ -317,7 +317,7 @@ class User < ApplicationRecord # 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 @@ -852,7 +852,7 @@ class User < ApplicationRecord end def mark_login! - update_attributes(last_logged_in_at: Time.now, login_failure_count: 0) + update(last_logged_in_at: Time.now, login_failure_count: 0) end def send_metric_for_beta_change -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Contact
Support
@OBShq
The Open Build Service is an
openSUSE project
.
Log In
Places
Places
All Projects
Status Monitor