diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-26 15:09:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-26 15:09:27 +0300 |
commit | 0121231095b3a50a18aaf4eb4a7058b55fe62fc1 (patch) | |
tree | a29154a1a62ff69fc8816b2694d25a3213cdcd30 /doc/development/ee_features.md | |
parent | 6fb22ef2ea39f92edf9b237f6e3eca6121c8298b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/ee_features.md')
-rw-r--r-- | doc/development/ee_features.md | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/doc/development/ee_features.md b/doc/development/ee_features.md index 5be601187ca..c1d77abf08e 100644 --- a/doc/development/ee_features.md +++ b/doc/development/ee_features.md @@ -92,12 +92,36 @@ class User < ActiveRecord::Base # ... lots of code here ... end -User.prepend_if_ee('EE::User') +User.prepend_ee_mod ``` Do not use methods such as `prepend`, `extend`, and `include`. Instead, use -`prepend_if_ee`, `extend_if_ee`, or `include_if_ee`. These methods take a -_String_ containing the full module name as the argument, not the module itself. +`prepend_ee_mod`, `extend_ee_mod`, or `include_ee_mod`. These methods will try to +find the relevant EE module by the name of the receiver module, for example; + +```ruby +module Vulnerabilities + class Finding + #... + end +end + +Vulnerabilities::Finding.prepend_ee_mod +``` + +will prepend the module named `::EE::Vulnerabilities::Finding`. + +If the extending module does not follow this naming convention, you can also provide the module name +by using `prepend_if_ee`, `extend_if_ee`, or `include_if_ee`. These methods take a +_String_ containing the full module name as the argument, not the module itself, like so; + +```ruby +class User + #... +end + +User.prepend_if_ee('::EE::UserExtension') +``` Since the module would require an `EE` namespace, the file should also be put in an `ee/` sub-directory. For example, we want to extend the user model |