Much base work started
This commit is contained in:
11
app/models/concerns/searchable.rb
Normal file
11
app/models/concerns/searchable.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
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
|
||||
Reference in New Issue
Block a user