11 lines
204 B
Ruby
11 lines
204 B
Ruby
module Searchable
|
|
extend ActiveSupport::Concern
|
|
|
|
class_methods do
|
|
def search(query)
|
|
return all if query.blank?
|
|
|
|
where("title LIKE ?", "%#{sanitize_sql_like(query)}%")
|
|
end
|
|
end
|
|
end |