Skip to content

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

put association class names in a constant

Ivan Kuchin97c04873842c
diff --git a/app/services/journals/create_service/association.rb b/app/services/journals/create_service/association.rb
index 6c05714f64c..6ec984e71ba 100644
--- a/app/services/journals/create_service/association.rb
+++ b/app/services/journals/create_service/association.rb
@@ -32,15 +32,17 @@ class Journals::CreateService
class Association
include Helpers
+ ASSOCIATION_NAMES = %i[
+ AgendaItemable
+ Attachable
+ Customizable
+ ProjectLifeCycleStep
+ Storable
+ ].freeze
+
def self.for(journable)
- [
- AgendaItemable,
- Attachable,
- Customizable,
- ProjectLifeCycleStep,
- Storable
- ]
- .map { _1.new(journable) }
+ ASSOCIATION_NAMES
+ .map { "Journals::CreateService::#{_1}".constantize.new(journable) }
.select(&:associated?)
end