diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-08-17 12:17:56 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-08-17 12:17:56 +0000 |
commit | 65d48623e2d39bb0174e707f9cd3bea5db8c50d1 (patch) | |
tree | 550fb978274466a45ed31d80e8bac6b9f8a1706d | |
parent | b399a274fbe350e0df8e75a7eaef313f01da5bb6 (diff) | |
parent | 42d2d64b84ee555c1c1520576652de43a9ce534a (diff) | |
download | gitlab-ce-65d48623e2d39bb0174e707f9cd3bea5db8c50d1.tar.gz |
Merge branch 'docs-mention-how-to-override-class-methods' into 'master'
Mention how to override CE class methods
See merge request gitlab-org/gitlab-ce!21276
-rw-r--r-- | doc/development/ee_features.md | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/doc/development/ee_features.md b/doc/development/ee_features.md index 32de741c9fe..1cd873b6fe3 100644 --- a/doc/development/ee_features.md +++ b/doc/development/ee_features.md @@ -258,6 +258,31 @@ end [`extend ::Gitlab::Utils::Override`]: utilities.md#override +##### Overriding CE class methods + +The same applies to class methods, except we want to use +`ActiveSupport::Concern` and put `extend ::Gitlab::Utils::Override` +within the block of `class_methods`. Here's an example: + +```ruby +module EE + module Groups + module GroupMembersController + extend ActiveSupport::Concern + + class_methods do + extend ::Gitlab::Utils::Override + + override :admin_not_required_endpoints + def admin_not_required_endpoints + super.concat(%i[update override]) + end + end + end + end +end +``` + #### Use self-descriptive wrapper methods When it's not possible/logical to modify the implementation of a @@ -665,6 +690,9 @@ module EE extend ActiveSupport::Concern class_methods do + extend ::Gitlab::Utils::Override + + override :update_params_at_least_one_of def update_params_at_least_one_of super.push(*%i[ squash |