mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
FIX search projects relation repository
This commit is contained in:
@@ -3,7 +3,7 @@ module Matchable
|
||||
|
||||
included do
|
||||
scope :like, lambda { |keywords|
|
||||
where("name LIKE ?", "%#{keywords.split(" ").join('|')}%") unless keywords.blank?
|
||||
joins(:repository).where(%w[ projects.name projects.identifier repositories.identifier ].map { |f| "LOWER(#{f}) LIKE :q" }.join(' OR '), q: "%#{keywords.split(" ").join('|')}%") unless keywords.blank?
|
||||
}
|
||||
scope :with_project_category, ->(category_id) { where(project_category_id: category_id) unless category_id.blank? }
|
||||
scope :with_project_language, ->(language_id) { where(project_language_id: language_id) unless language_id.blank? }
|
||||
|
||||
Reference in New Issue
Block a user