Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-07-07 18:43:37 +0300
committerDouwe Maan <douwe@selenight.nl>2017-07-07 18:43:37 +0300
commitc81928cfa757b6f42debd6d1c3b6cdb860fc14f5 (patch)
tree2069795e9fce322b3ab27a20c54dd8348fd4277a /config
parent1dab640357fa1ba8992757499e4167fcd4ce6276 (diff)
Include new URL helpers retroactively into includers of Gitlab::Routing
Diffstat (limited to 'config')
-rw-r--r--config/application.rb14
1 files changed, 4 insertions, 10 deletions
diff --git a/config/application.rb b/config/application.rb
index 3e6d72810cd..d88740ef8d7 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -166,9 +166,10 @@ module Gitlab
config.after_initialize do
Rails.application.reload_routes!
- named_routes_set = Gitlab::Application.routes.named_routes
project_url_helpers = Module.new do
- named_routes_set.helper_names.each do |name|
+ extend ActiveSupport::Concern
+
+ Gitlab::Application.routes.named_routes.helper_names.each do |name|
next unless name.include?('namespace_project')
define_method(name.sub('namespace_project', 'project')) do |project, *args|
@@ -177,14 +178,7 @@ module Gitlab
end
end
- named_routes_set.url_helpers_module.include project_url_helpers
- named_routes_set.url_helpers_module.extend project_url_helpers
-
- Gitlab::Routing.url_helpers.include project_url_helpers
- Gitlab::Routing.url_helpers.extend project_url_helpers
-
- GitlabRoutingHelper.include project_url_helpers
- GitlabRoutingHelper.extend project_url_helpers
+ Gitlab::Routing.add_helpers(project_url_helpers)
end
end
end