diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-19 21:07:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-19 21:07:43 +0300 |
commit | 1e1012d3d28c426637eecc0909c415fe2c8b7c3a (patch) | |
tree | d230780752bb3b98cf4f3ede1c6f8e98c9a238c7 /app/models/ml | |
parent | 3c55affa6684311ca73bc4e3d3bfb17b7541f63b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/ml')
-rw-r--r-- | app/models/ml/model.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/ml/model.rb b/app/models/ml/model.rb index 27f03ed5857..3d21f5bd218 100644 --- a/app/models/ml/model.rb +++ b/app/models/ml/model.rb @@ -3,6 +3,7 @@ module Ml class Model < ApplicationRecord include Presentable + include Sortable validates :project, :default_experiment, presence: true validates :name, @@ -24,6 +25,7 @@ module Ml .select("ml_models.*, count(ml_model_versions.id) as version_count") .group(:id) } + scope :by_name, ->(name) { where("ml_models.name LIKE ?", "%#{sanitize_sql_like(name)}%") } # rubocop:disable GitlabSecurity/SqlInjection scope :by_project, ->(project) { where(project_id: project.id) } def valid_default_experiment? |