mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-07 21:51:42 +08:00
init project
This commit is contained in:
13
app/models/concerns/matchable.rb
Normal file
13
app/models/concerns/matchable.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
module Matchable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
scope :like, lambda { |keywords|
|
||||
where("name LIKE ?", "%#{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? }
|
||||
scope :with_project_type, ->(project_type) { where(project_type: project_type) if Project.project_types.include?(project_type) }
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user