diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-15 18:09:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-15 18:09:41 +0300 |
commit | 1581767ea15fcfa63919d39c0d3579da0a4de96e (patch) | |
tree | 4df66765670360645ffc77a9e402092ab52c14f5 /app/models/repository_language.rb | |
parent | 01d2d6c8695d03440d68b262806f709b57da63b4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/repository_language.rb')
-rw-r--r-- | app/models/repository_language.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/repository_language.rb b/app/models/repository_language.rb index b7a96211fb1..2816aa4cc5b 100644 --- a/app/models/repository_language.rb +++ b/app/models/repository_language.rb @@ -8,6 +8,10 @@ class RepositoryLanguage < ApplicationRecord default_scope { includes(:programming_language) } # rubocop:disable Cop/DefaultScope + scope :with_programming_language, ->(name) do + joins(:programming_language).merge(ProgrammingLanguage.with_name_case_insensitive(name)) + end + validates :project, presence: true validates :share, inclusion: { in: 0..100, message: "The share of a language is between 0 and 100" } validates :programming_language, uniqueness: { scope: :project_id } |