diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-07-07 18:43:37 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-07-07 18:43:37 +0300 |
commit | c81928cfa757b6f42debd6d1c3b6cdb860fc14f5 (patch) | |
tree | 2069795e9fce322b3ab27a20c54dd8348fd4277a /lib/gitlab/routing.rb | |
parent | 1dab640357fa1ba8992757499e4167fcd4ce6276 (diff) |
Include new URL helpers retroactively into includers of Gitlab::Routing
Diffstat (limited to 'lib/gitlab/routing.rb')
-rw-r--r-- | lib/gitlab/routing.rb | 20 |
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 |