diff options
| author | Winnie Hellmann <winnie@gitlab.com> | 2019-08-27 08:59:42 +0200 |
|---|---|---|
| committer | Winnie Hellmann <winnie@gitlab.com> | 2019-08-27 11:05:56 +0200 |
| commit | e3ee58e2557698c9e589c010d91cc0f874d57035 (patch) | |
| tree | f1091182c04430b820a082ed7f54b833f10dec07 /config/initializers | |
| parent | 16c1cd66a5679a91aee14161490779ce92934c61 (diff) | |
| download | gitlab-ce-winh-prepend-entity.tar.gz | |
Prepend entity descendant where necessarywinh-prepend-entity
(cherry picked from commit b87526e8c47b7a3938ab12842bbac99a17fcb750)
Diffstat (limited to 'config/initializers')
| -rw-r--r-- | config/initializers/0_inject_enterprise_edition_module.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/config/initializers/0_inject_enterprise_edition_module.rb b/config/initializers/0_inject_enterprise_edition_module.rb index 39595e23abe..b3ebb44ef25 100644 --- a/config/initializers/0_inject_enterprise_edition_module.rb +++ b/config/initializers/0_inject_enterprise_edition_module.rb @@ -3,8 +3,15 @@ require 'active_support/inflector' module InjectEnterpriseEditionModule - def prepend_if_ee(constant) - prepend(constant.constantize) if Gitlab.ee? + def prepend_if_ee(constant, with_descendants: false) + return unless Gitlab.ee? + + ee_module = constant.constantize + prepend(ee_module) + + if with_descendants + descendants.each { |descendant| descendant.prepend(ee_module) } + end end def extend_if_ee(constant) |
