From bbaf2bb0438b1c71020d9d216feb528add225a7f Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 3 Mar 2020 21:08:37 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- doc/development/application_limits.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'doc/development/application_limits.md') diff --git a/doc/development/application_limits.md b/doc/development/application_limits.md index c3bfe20dd87..dd07a9cbfb7 100644 --- a/doc/development/application_limits.md +++ b/doc/development/application_limits.md @@ -15,10 +15,6 @@ limits](https://about.gitlab.com/handbook/product/#introducing-application-limit ## Development -The merge request to [configure maximum number of webhooks per -project](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/20730/diffs) is a -good example about configuring application limits. - ### Insert database plan limits In the `plan_limits` table, you have to create a new column and insert the @@ -78,12 +74,22 @@ can be used to validate that a model does not exceed the limits. It ensures that the count of the records for the current model does not exceed the defined limit. -NOTE: **Note:** The name (pluralized) of the plan limit introduced in the -database (`project_hooks`) must correspond to the name of the model we are -validating (`ProjectHook`). +NOTE: **Note:** You must specify the limit scope of the object being validated +and the limit name if it's different from the pluralized model name. ```ruby class ProjectHook include Limitable + + self.limit_name = 'project_hooks' # Optional as ProjectHook corresponds with project_hooks + self.limit_scope = :project +end +``` + +To test the model, you can include the shared examples. + +```ruby +it_behaves_like 'includes Limitable concern' do + subject { build(:project_hook, project: create(:project)) } end ``` -- cgit v1.2.3