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
Make PathHelper routing independent (#9186)
ulfertsbf9639243df9
diff --git a/lib/api/v3/utilities/path_helper.rb b/lib/api/v3/utilities/path_helper.rbindex ba6f035b18a..608c99a3a5c 100644--- a/lib/api/v3/utilities/path_helper.rb+++ b/lib/api/v3/utilities/path_helper.rb@@ -49,33 +49,30 @@ module APIprivate_class_method :indexdef self.show(name)- define_singleton_method(name) do |id|- "#{send(name.to_s.pluralize)}/#{id}"- end+ define_singleton_method(name) { |id| build_path(name, id) }endprivate_class_method :showdef self.create_form(name)- define_singleton_method(:"create_#{name}_form") do- "#{send(name.to_s.pluralize)}/form"- end+ define_singleton_method(:"create_#{name}_form") { build_path(name, "form") }endprivate_class_method :create_formdef self.update_form(name)- define_singleton_method(:"#{name}_form") do |id|- "#{send(name, id)}/form"- end+ define_singleton_method(:"#{name}_form") { |id| build_path(name, id, "form") }endprivate_class_method :update_formdef self.schema(name)- define_singleton_method(:"#{name}_schema") do- "#{send(name.to_s.pluralize)}/schema"- end+ define_singleton_method(:"#{name}_schema") { build_path(name, "schema") }endprivate_class_method :schema+ def self.build_path(name, *kwargs)+ [root, name.to_s.pluralize, *kwargs].compact.join("/")+ end+ private_class_method :build_path+def self.resources(name,except: [],only: %i[index show create_form update_form schema])