You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
583 B
14 lines
583 B
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
|