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
extract key as constant and simplify usage
Ivan Kuchin8d2cda9af8a6
diff --git a/app/models/queries/projects/selects/custom_field.rb b/app/models/queries/projects/selects/custom_field.rbindex cdb19adb8d3..14d7401bde5 100644--- a/app/models/queries/projects/selects/custom_field.rb+++ b/app/models/queries/projects/selects/custom_field.rb@@ -29,8 +29,10 @@class Queries::Projects::Selects::CustomField < Queries::Selects::Basevalidates :custom_field, presence: { message: I18n.t(:"activerecord.errors.messages.does_not_exist") }+ KEY = /\Acf_(\d+)\z/+def self.key- /\Acf_(\d+)\z/+ KEYenddef self.all_available@@ -51,7 +53,7 @@ class Queries::Projects::Selects::CustomField < Queries::Selects::Base@custom_field = ProjectCustomField.visible- .find_by(id: self.class.key.match(attribute)[1])+ .find_by(id: attribute[KEY, 1])enddef available?