summaryrefslogtreecommitdiff
path: root/lib/gitlab/routing.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-07-07 10:43:37 -0500
committerDouwe Maan <douwe@selenight.nl>2017-07-07 10:43:37 -0500
commitc81928cfa757b6f42debd6d1c3b6cdb860fc14f5 (patch)
tree2069795e9fce322b3ab27a20c54dd8348fd4277a /lib/gitlab/routing.rb
parent1dab640357fa1ba8992757499e4167fcd4ce6276 (diff)
downloadgitlab-ce-c81928cfa757b6f42debd6d1c3b6cdb860fc14f5.tar.gz
Include new URL helpers retroactively into includers of Gitlab::Routingdm-fix-project-path-helpers-production
Diffstat (limited to 'lib/gitlab/routing.rb')
-rw-r--r--lib/gitlab/routing.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/gitlab/routing.rb b/lib/gitlab/routing.rb
index 632e2d87500..ac1e864433b 100644
--- a/lib/gitlab/routing.rb
+++ b/lib/gitlab/routing.rb
@@ -2,10 +2,30 @@ module Gitlab
module Routing
extend ActiveSupport::Concern
+ mattr_accessor :_includers
+ self._includers = []
+
included do
+ Gitlab::Routing._includers << self
include Gitlab::Routing.url_helpers
end
+ def self.add_helpers(mod)
+ url_helpers.include mod
+ url_helpers.extend mod
+
+ app_url_helpers = Gitlab::Application.routes.named_routes.url_helpers_module
+ app_url_helpers.include mod
+ app_url_helpers.extend mod
+
+ GitlabRoutingHelper.include mod
+ GitlabRoutingHelper.extend mod
+
+ _includers.each do |klass|
+ klass.include mod
+ end
+ end
+
# Returns the URL helpers Module.
#
# This method caches the output as Rails' "url_helpers" method creates an