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
Fixes Performance/DeleteSuffix offenses
Klaus Zandersbf1293a36167
diff --git a/app/contracts/base_contract.rb b/app/contracts/base_contract.rbindex 4690537584b..67dd50a6ab5 100644--- a/app/contracts/base_contract.rb+++ b/app/contracts/base_contract.rb@@ -101,7 +101,7 @@ class BaseContract < Disposable::Twinprivatedef add_writable(attribute, writable)- attribute_name = attribute.to_s.gsub /_id\z/, ''+ attribute_name = attribute.to_s.delete_suffix('_id')unless writable == falsewritable_attributes << attribute_name@@ -244,7 +244,7 @@ class BaseContract < Disposable::Twinattribute_permissions = collect_ancestor_attributes(:attribute_permissions)attributes.reject do |attribute|- canonical_attribute = attribute.gsub(/_id\z/, '')+ canonical_attribute = attribute.delete_suffix('_id')permissions = attribute_permissions[canonical_attribute] ||attribute_permissions["#{canonical_attribute}_id"] ||diff --git a/lib/open_project/patches/active_record_i18n.rb b/lib/open_project/patches/active_record_i18n.rbindex 9a8eb2f49e0..486a6ecf2fd 100644--- a/lib/open_project/patches/active_record_i18n.rb+++ b/lib/open_project/patches/active_record_i18n.rb@@ -31,7 +31,7 @@ module ActiveRecordinclude Redmine::I18ndef self.human_attribute_name(attr, options = {})- attr = attr.to_s.gsub(/_id\z/, '')+ attr = attr.to_s.delete_suffix('_id')superendend