OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Replace deprecated `update_attribute` with `update`
Oliver Günther693bd7760a5c
diff --git a/app/controllers/auth_sources_controller.rb b/app/controllers/auth_sources_controller.rbindex 9a5fc8e203c..492f5f0c170 100644--- a/app/controllers/auth_sources_controller.rb+++ b/app/controllers/auth_sources_controller.rb@@ -66,7 +66,7 @@ class AuthSourcesController < ApplicationControllerupdated = permitted_params.auth_sourceupdated.delete :account_password if updated[:account_password].blank?- if @auth_source.update_attributes updated+ if @auth_source.update updatedflash[:notice] = l(:notice_successful_update)redirect_to action: 'index'elsediff --git a/app/controllers/colors_controller.rb b/app/controllers/colors_controller.rbindex 7ed62a5a769..a5f229f91fd 100644--- a/app/controllers/colors_controller.rb+++ b/app/controllers/colors_controller.rb@@ -76,7 +76,7 @@ class ColorsController < ApplicationControllerdef update@color = Color.find(params[:id])- if @color.update_attributes(permitted_params.color)+ if @color.update(permitted_params.color)flash[:notice] = l(:notice_successful_update)redirect_to colors_pathelsediff --git a/app/controllers/concerns/omniauth_login.rb b/app/controllers/concerns/omniauth_login.rbindex 147037a0cb4..3efdd459380 100644--- a/app/controllers/concerns/omniauth_login.rb+++ b/app/controllers/concerns/omniauth_login.rb@@ -167,7 +167,7 @@ module Concerns::OmniauthLoginreturn if handle_omniauth_registration_expired(auth)fill_user_fields_from_omniauth(user, auth)- user.update_attributes(permitted_params.user_register_via_omniauth)+ user.update(permitted_params.user_register_via_omniauth)opts = {omni_auth_hash: authdiff --git a/app/controllers/custom_styles_controller.rb b/app/controllers/custom_styles_controller.rbindex 57561ec5d79..c6d8d1ebc6d 100644--- a/app/controllers/custom_styles_controller.rb+++ b/app/controllers/custom_styles_controller.rb@@ -53,7 +53,7 @@ class CustomStylesController < ApplicationControllerdef update@custom_style = CustomStyle.current- if @custom_style.update_attributes(custom_style_params)+ if @custom_style.update(custom_style_params)redirect_to custom_style_pathelseflash[:error] = @custom_style.errors.full_messagesdiff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rbindex ddfe82af9a2..8b06408db9c 100644--- a/app/controllers/enumerations_controller.rb+++ b/app/controllers/enumerations_controller.rb@@ -67,7 +67,7 @@ class EnumerationsController < ApplicationControllerenum_params = permitted_params.enumerationstype = permitted_params.enumeration_type@enumeration.type = enumeration_class(type).try(:name) || @enumeration.type- if @enumeration.update_attributes enum_params+ if @enumeration.update enum_paramsflash[:notice] = l(:notice_successful_update)redirect_to enumerations_path(type: @enumeration.type)elsediff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rbindex 9a87d66a44d..65a2ccb0884 100644--- a/app/controllers/forums_controller.rb+++ b/app/controllers/forums_controller.rb@@ -106,7 +106,7 @@ class ForumsController < ApplicationControllerdef edit; enddef update- if @forum.update_attributes(permitted_params.forum)+ if @forum.update(permitted_params.forum)flash[:notice] = l(:notice_successful_update)redirect_to_settings_in_projectselse@@ -115,7 +115,7 @@ class ForumsController < ApplicationControllerenddef move- if @forum.update_attributes(permitted_params.forum_move)+ if @forum.update(permitted_params.forum_move)flash[:notice] = t(:notice_successful_update)elseflash.now[:error] = t('forum_could_not_be_saved')diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rbindex ebeb155cc26..b58244dd85f 100644--- a/app/controllers/groups_controller.rb+++ b/app/controllers/groups_controller.rb@@ -97,7 +97,7 @@ class GroupsController < ApplicationController@group = Group.includes(:users).find(params[:id])respond_to do |format|- if @group.update_attributes(permitted_params.group)+ if @group.update(permitted_params.group)flash[:notice] = l(:notice_successful_update)format.html do redirect_to(groups_path) endformat.xml do head :ok enddiff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rbindex c7b5ec08ce3..c8dc6cef95a 100644--- a/app/controllers/statuses_controller.rb+++ b/app/controllers/statuses_controller.rb@@ -66,7 +66,7 @@ class StatusesController < ApplicationControllerverify method: :patch, only: :update, render: { nothing: true, status: :method_not_allowed }def update@status = Status.find(params[:id])- if @status.update_attributes(permitted_params.status)+ if @status.update(permitted_params.status)flash[:notice] = l(:notice_successful_update)redirect_to action: 'index'elsediff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rbindex 0d5f04fd831..9be9b77de6d 100644--- a/app/controllers/types_controller.rb+++ b/app/controllers/types_controller.rb@@ -101,7 +101,7 @@ class TypesController < ApplicationControllerdef move@type = ::Type.find(params[:id])- if @type.update_attributes(permitted_params.type_move)+ if @type.update(permitted_params.type_move)flash[:notice] = l(:notice_successful_update)elseflash.now[:error] = t('type_could_not_be_saved')diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rbindex 958f2699735..a1396ec9eef 100644--- a/app/controllers/wiki_controller.rb+++ b/app/controllers/wiki_controller.rb@@ -224,7 +224,7 @@ class WikiController < ApplicationControllerexisting_identifier: item.name)redirect_to_show- elsif @page.update_attributes(attributes)+ elsif @page.update(attributes)flash[:notice] = t(:notice_successful_update)redirect_to_showenddiff --git a/app/models/journal.rb b/app/models/journal.rbindex af571bb02c9..b1ece40c7b4 100644--- a/app/models/journal.rb+++ b/app/models/journal.rb@@ -60,7 +60,7 @@ class Journal < ActiveRecord::Baseif attributes.is_a? Hash and attributes.values.first.is_a? Arrayattributes.each { |k, v| attributes[k] = v[1] }end- data.update_attributes attributes+ data.update attributesend# In conjunction with the included Comparable module, allows comparison of journal recordsdiff --git a/app/models/project.rb b/app/models/project.rbindex 30a9f6be250..54a16a527de 100644--- a/app/models/project.rb+++ b/app/models/project.rb@@ -277,7 +277,7 @@ class Project < ActiveRecord::Basecreate_time_entry_activity_if_needed(activity_hash)elseactivity = project.time_entry_activities.find_by(id: id.to_i)- activity.update_attributes(activity_hash) if activity+ activity.update(activity_hash) if activityendenddiff --git a/app/seeders/basic_data/role_seeder.rb b/app/seeders/basic_data/role_seeder.rbindex 3035388057d..6122a80fbdf 100644--- a/app/seeders/basic_data/role_seeder.rb+++ b/app/seeders/basic_data/role_seeder.rb@@ -35,7 +35,7 @@ module BasicDataendbuiltin_roles.each do |attributes|- Role.find_by!(name: attributes[:name]).update_attributes(attributes)+ Role.find_by!(name: attributes[:name]).update(attributes)endendenddiff --git a/app/workers/scm/storage_updater_job.rb b/app/workers/scm/storage_updater_job.rbindex 0f82999461b..6550b9c0eee 100644--- a/app/workers/scm/storage_updater_job.rb+++ b/app/workers/scm/storage_updater_job.rb@@ -42,7 +42,7 @@ class Scm::StorageUpdaterJob < ApplicationJobrepository = Repository.find @idbytes = repository.scm.count_repository!- repository.update_attributes!(+ repository.update!(required_storage_bytes: bytes,storage_updated_at: Time.now,)diff --git a/features/step_definitions/common_steps.rb b/features/step_definitions/common_steps.rbindex 7f64d99cee8..958b6bdc8b0 100644--- a/features/step_definitions/common_steps.rb+++ b/features/step_definitions/common_steps.rb@@ -48,7 +48,7 @@ Given /^the [pP]roject(?: "([^\"]+?)")? uses the following types:$/ do |project,type}- project.update_attributes type_ids: types.map(&:id).map(&:to_s)+ project.update type_ids: types.map(&:id).map(&:to_s)endThen(/^I should see the following fields:$/) do |table|diff --git a/modules/auth_saml/lib/open_project/auth_saml/engine.rb b/modules/auth_saml/lib/open_project/auth_saml/engine.rbindex 4c8d2396cb0..7936f0b5df2 100644--- a/modules/auth_saml/lib/open_project/auth_saml/engine.rb+++ b/modules/auth_saml/lib/open_project/auth_saml/engine.rb@@ -26,7 +26,7 @@ module OpenProject# Don't allow unsetting admin if user is already adminattributes.delete(:admin) if user.admin?- user.update_attributes attributes+ user.update attributesendenddiff --git a/modules/backlogs/app/controllers/rb_sprints_controller.rb b/modules/backlogs/app/controllers/rb_sprints_controller.rbindex 56ee9a00e53..4527d6f21d0 100644--- a/modules/backlogs/app/controllers/rb_sprints_controller.rb+++ b/modules/backlogs/app/controllers/rb_sprints_controller.rb@@ -39,7 +39,7 @@# RbTaskboardsControllerclass RbSprintsController < RbApplicationControllerdef update- result = @sprint.update_attributes(params.permit(:name,+ result = @sprint.update(params.permit(:name,:start_date,:effective_date))status = (result ? 200 : 400)diff --git a/modules/bcf/lib/open_project/bcf/bcf_xml/issue_reader.rb b/modules/bcf/lib/open_project/bcf/bcf_xml/issue_reader.rbindex 4f54774c387..14584f26e9c 100644--- a/modules/bcf/lib/open_project/bcf/bcf_xml/issue_reader.rb+++ b/modules/bcf/lib/open_project/bcf/bcf_xml/issue_reader.rb@@ -399,7 +399,7 @@ module OpenProject::Bcf::BcfXmlenddef update_journal_attributes(bcf_comment, comment_data)- bcf_comment.journal.update_attributes(notes: comment_data[:comment],+ bcf_comment.journal.update(notes: comment_data[:comment],created_at: comment_data[:modified_date])bcf_comment.journal.saveenddiff --git a/modules/documents/spec/controllers/documents_controller_spec.rb b/modules/documents/spec/controllers/documents_controller_spec.rbindex 312641e05a4..48bd30ed8a3 100644--- a/modules/documents/spec/controllers/documents_controller_spec.rb+++ b/modules/documents/spec/controllers/documents_controller_spec.rb@@ -71,7 +71,7 @@ describe DocumentsController do}before do- document.update_attributes(description: long_description)+ document.update(description: long_description)get :index, params: { project_id: project.identifier }enddiff --git a/modules/pdf_export/app/controllers/export_card_configurations_controller.rb b/modules/pdf_export/app/controllers/export_card_configurations_controller.rbindex fcba657303f..df40e962c4a 100644--- a/modules/pdf_export/app/controllers/export_card_configurations_controller.rb+++ b/modules/pdf_export/app/controllers/export_card_configurations_controller.rb@@ -58,7 +58,7 @@ class ExportCardConfigurationsController < ApplicationControllerif cannot_update_defaultflash[:error] = l(:error_can_not_change_name_of_default_configuration)render "edit"- elsif @config.update_attributes(export_card_configurations_params)+ elsif @config.update(export_card_configurations_params)flash[:notice] = l(:notice_successful_update)redirect_to :action => 'index'elsediff --git a/modules/pdf_export/app/models/export_card_configuration.rb b/modules/pdf_export/app/models/export_card_configuration.rbindex 4e28177ad47..2f58a75448c 100644--- a/modules/pdf_export/app/models/export_card_configuration.rb+++ b/modules/pdf_export/app/models/export_card_configuration.rb@@ -108,12 +108,12 @@ class ExportCardConfiguration < ActiveRecord::Baseenddef activate- self.update_attributes!({active: true})+ self.update!({active: true})enddef deactivateif !self.is_default?- self.update_attributes!({active: false})+ self.update!({active: false})elsefalseenddiff --git a/spec/controllers/custom_styles_controller_spec.rb b/spec/controllers/custom_styles_controller_spec.rbindex 9198ea80c67..e0b8040ad94 100644--- a/spec/controllers/custom_styles_controller_spec.rb+++ b/spec/controllers/custom_styles_controller_spec.rb@@ -119,7 +119,7 @@ describe CustomStylesController, type: :controller dowith_enterprise_token(:define_custom_style)expect(CustomStyle).to receive(:current).and_return(custom_style)- expect(custom_style).to receive(:update_attributes).and_return(valid)+ expect(custom_style).to receive(:update).and_return(valid)post :update, params: paramsenddiff --git a/spec/controllers/wiki_controller_spec.rb b/spec/controllers/wiki_controller_spec.rbindex 18633ad2060..01b9bf8e500 100644--- a/spec/controllers/wiki_controller_spec.rb+++ b/spec/controllers/wiki_controller_spec.rb@@ -241,7 +241,7 @@ describe WikiController, type: :controller do@anon = User.anonymous.nil? ? FactoryBot.create(:anonymous) : User.anonymous- Role.anonymous.update_attributes name: I18n.t(:default_role_anonymous),+ Role.anonymous.update name: I18n.t(:default_role_anonymous),permissions: [:view_wiki_pages]allow(User).to receive(:current).and_return @userdiff --git a/spec/features/projects/projects_index_spec.rb b/spec/features/projects/projects_index_spec.rbindex c42ddf1ec82..4ffa0203f9f 100644--- a/spec/features/projects/projects_index_spec.rb+++ b/spec/features/projects/projects_index_spec.rb@@ -122,7 +122,7 @@ describe 'Projects index page',feature 'for admins' dobefore do- project.update_attributes(created_on: 7.days.ago)+ project.update(created_on: 7.days.ago)newsend@@ -632,7 +632,7 @@ describe 'Projects index page',# Remove public projects from the default list for these scenarios.public_project.update_attribute :status, Project::STATUS_ARCHIVED- project.update_attributes(created_on: 7.days.ago)+ project.update(created_on: 7.days.ago)newsenddiff --git a/spec/features/users/index_spec.rb b/spec/features/users/index_spec.rbindex 71d6e77179b..78294d41857 100644--- a/spec/features/users/index_spec.rb+++ b/spec/features/users/index_spec.rb@@ -79,7 +79,7 @@ describe 'index users', type: :feature doindex_page.expect_listed(active_user)# temporarily block user- active_user.update_attributes(failed_login_count: 6,+ active_user.update(failed_login_count: 6,last_failed_login_on: 9.minutes.ago)index_page.clear_filtersindex_page.expect_listed(admin, active_user, registered_user, invited_user)@@ -92,7 +92,7 @@ describe 'index users', type: :feature do# temporarily block user and lock permanentlyactive_user.reload- active_user.update_attributes(failed_login_count: 6,+ active_user.update(failed_login_count: 6,last_failed_login_on: 9.minutes.ago)index_page.clear_filtersdiff --git a/spec/features/work_packages/edit_work_package_spec.rb b/spec/features/work_packages/edit_work_package_spec.rbindex cf931c04b04..de014b601ef 100644--- a/spec/features/work_packages/edit_work_package_spec.rb+++ b/spec/features/work_packages/edit_work_package_spec.rb@@ -50,7 +50,7 @@ describe 'edit work package', js: true docreated_at: 5.days.ago.to_date.to_s(:db))note_journal = work_package.journals.last- note_journal.update_attributes(created_at: 5.days.ago.to_date.to_s)+ note_journal.update(created_at: 5.days.ago.to_date.to_s)work_packageenddiff --git a/spec/features/work_packages/tabs/activity_revisions_spec.rb b/spec/features/work_packages/tabs/activity_revisions_spec.rbindex cd942f29eb1..26be4577b56 100644--- a/spec/features/work_packages/tabs/activity_revisions_spec.rb+++ b/spec/features/work_packages/tabs/activity_revisions_spec.rb@@ -5,10 +5,10 @@ require 'support/work_packages/work_package_field'describe 'Activity tab', js: true, selenium: true dodef alter_work_package_at(work_package, attributes:, at:, user: User.current)- work_package.update_attributes(attributes.merge(updated_at: at))+ work_package.update(attributes.merge(updated_at: at))note_journal = work_package.journals.last- note_journal.update_attributes(created_at: at, user: attributes[:user])+ note_journal.update(created_at: at, user: attributes[:user])endlet(:project) { FactoryBot.create :project_with_types, is_public: true }@@ -20,7 +20,7 @@ describe 'Activity tab', js: true, selenium: true dojournal_notes: initial_comment)note_journal = work_package.journals.last- note_journal.update_attributes(created_at: 5.days.ago.to_date.to_s)+ note_journal.update(created_at: 5.days.ago.to_date.to_s)work_packageenddiff --git a/spec/features/work_packages/tabs/activity_tab_spec.rb b/spec/features/work_packages/tabs/activity_tab_spec.rbindex dfa2648611d..96d66c88f70 100644--- a/spec/features/work_packages/tabs/activity_tab_spec.rb+++ b/spec/features/work_packages/tabs/activity_tab_spec.rb@@ -5,10 +5,10 @@ require 'support/work_packages/work_package_field'describe 'Activity tab', js: true, selenium: true dodef alter_work_package_at(work_package, attributes:, at:, user: User.current)- work_package.update_attributes(attributes.merge(updated_at: at))+ work_package.update(attributes.merge(updated_at: at))note_journal = work_package.journals.last- note_journal.update_attributes(created_at: at, user: attributes[:user])+ note_journal.update(created_at: at, user: attributes[:user])endlet(:project) { FactoryBot.create :project_with_types, is_public: true }@@ -20,7 +20,7 @@ describe 'Activity tab', js: true, selenium: true dojournal_notes: initial_comment)note_journal = work_package.journals.last- note_journal.update_attributes(created_at: 5.days.ago.to_date.to_s)+ note_journal.update(created_at: 5.days.ago.to_date.to_s)work_packageenddiff --git a/spec/features/work_packages/work_package_workflow_form_spec.rb b/spec/features/work_packages/work_package_workflow_form_spec.rbindex 25c8ec73b1b..54b86a2f9c5 100644--- a/spec/features/work_packages/work_package_workflow_form_spec.rb+++ b/spec/features/work_packages/work_package_workflow_form_spec.rb@@ -55,7 +55,7 @@ describe 'Work package transitive status workflows', js: true docreated_at: 5.days.ago.to_date.to_s(:db)note_journal = work_package.journals.last- note_journal.update_attributes(created_at: 5.days.ago.to_date.to_s)+ note_journal.update(created_at: 5.days.ago.to_date.to_s)work_package}diff --git a/spec/models/project/storage_spec.rb b/spec/models/project/storage_spec.rbindex 75564d1a0e8..b7fe390cc4c 100644--- a/spec/models/project/storage_spec.rb+++ b/spec/models/project/storage_spec.rb@@ -47,7 +47,7 @@ describe Project::Storage, type: :model doFactoryBot.create(:attachment, filesize: 10000, container: wikipage)repo = FactoryBot.create(:repository_git, project: project2)- repo.update_attributes(required_storage_bytes: 1234)+ repo.update(required_storage_bytes: 1234)enddescribe '#with_required_storage' do@@ -80,7 +80,7 @@ describe Project::Storage, type: :model docontext 'with a project with all modules' dolet(:repository1) { FactoryBot.create(:repository_git, project: project1) }before do- repository1.update_attributes(required_storage_bytes: 543211234)+ repository1.update(required_storage_bytes: 543211234)endit 'counts all projects correctly' dodiff --git a/spec/models/work_package/openproject_notifications_spec.rb b/spec/models/work_package/openproject_notifications_spec.rbindex b8924739cd1..2580e730412 100644--- a/spec/models/work_package/openproject_notifications_spec.rb+++ b/spec/models/work_package/openproject_notifications_spec.rb@@ -67,7 +67,7 @@ describe WorkPackage, type: :model dojournal_ids.clear- work_package.update_attributes subject: 'the wind of change'+ work_package.update subject: 'the wind of change'endit "are triggered" dodiff --git a/spec/models/work_package/work_package_acts_as_watchable_spec.rb b/spec/models/work_package/work_package_acts_as_watchable_spec.rbindex 3c44e26c50b..28e2c7789c9 100644--- a/spec/models/work_package/work_package_acts_as_watchable_spec.rb+++ b/spec/models/work_package/work_package_acts_as_watchable_spec.rb@@ -60,7 +60,7 @@ describe WorkPackage, type: :model doendit 'sends one delayed mail notification for each watcher recipient' do- work_package.update_attributes description: 'Any new description'+ work_package.update description: 'Any new description'endendenddiff --git a/spec/models/work_package/work_package_notifications_spec.rb b/spec/models/work_package/work_package_notifications_spec.rbindex 79751ed5812..bf652f7075a 100644--- a/spec/models/work_package/work_package_notifications_spec.rb+++ b/spec/models/work_package/work_package_notifications_spec.rb@@ -72,7 +72,7 @@ describe WorkPackage, type: :model dodescribe 'after update' dobefore do- work_package.update_attributes subject: 'the wind of change'+ work_package.update subject: 'the wind of change'endit "are sent to the work package's author" dodiff --git a/spec/support/scm/relocate_repository.rb b/spec/support/scm/relocate_repository.rbindex 66e80cbf30f..8585da62d38 100644--- a/spec/support/scm/relocate_repository.rb+++ b/spec/support/scm/relocate_repository.rb@@ -27,7 +27,7 @@ shared_examples_for 'repository can be relocated' do |vendor|expect(Dir.exists?(repository.managed_repository_path)).to be true# Rename the project- project.update_attributes!(identifier: 'somenewidentifier')+ project.update!(identifier: 'somenewidentifier')repository.reloadjob.performdiff --git a/spec/support/shared/acts_as_watchable.rb b/spec/support/shared/acts_as_watchable.rbindex 15206bbc610..f9630357221 100644--- a/spec/support/shared/acts_as_watchable.rb+++ b/spec/support/shared/acts_as_watchable.rb@@ -132,7 +132,7 @@ MESSAGEcontext 'when it is a public project' dobefore do- project.update_attributes is_public: true+ project.update is_public: truemodel_instance.reloadend@@ -150,7 +150,7 @@ MESSAGEcontext 'when it is a private project' dobefore do- project.update_attributes is_public: false+ project.update is_public: falsemodel_instance.reloadend@@ -241,7 +241,7 @@ MESSAGEcontext 'when it is a public project' dobefore do- project.update_attributes is_public: true+ project.update is_public: truemodel_instance.reloadend@@ -275,7 +275,7 @@ MESSAGEcontext 'when it is a private project' dobefore do- project.update_attributes is_public: false+ project.update is_public: falsemodel_instance.reloadenddiff --git a/spec_legacy/unit/enumeration_spec.rb b/spec_legacy/unit/enumeration_spec.rbindex f3debb03ce2..2f56e3e0f1b 100644--- a/spec_legacy/unit/enumeration_spec.rb+++ b/spec_legacy/unit/enumeration_spec.rb@@ -63,18 +63,18 @@ describe Enumeration, type: :model doendit 'should update default' do- @default_enumeration.update_attributes(name: 'Changed', is_default: true)+ @default_enumeration.update(name: 'Changed', is_default: true)assert_equal @default_enumeration, Enumeration.defaultendit 'should update default to non default' do- @default_enumeration.update_attributes(name: 'Changed', is_default: false)+ @default_enumeration.update(name: 'Changed', is_default: false)assert_nil Enumeration.defaultendit 'should change default' doe = Enumeration.find_by(name: @default_enumeration.name)- e.update_attributes(name: 'Changed Enumeration', is_default: true)+ e.update(name: 'Changed Enumeration', is_default: true)assert_equal e, Enumeration.defaultend