forked from jasder/forgeplus
FIX search projects relation repository
This commit is contained in:
parent
ea74a7ab0a
commit
fe9ac94222
|
@ -3,7 +3,7 @@ module Matchable
|
||||||
|
|
||||||
included do
|
included do
|
||||||
scope :like, lambda { |keywords|
|
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_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? }
|
scope :with_project_language, ->(language_id) { where(project_language_id: language_id) unless language_id.blank? }
|
||||||
|
|
Loading…
Reference in New Issue