Trek::Searchable
Accent-insensitive full-text search on a record's page title, using PostgreSQL's unaccent extension.
What it adds
- A
search(query)scope — joins to the associated page and matches the title with an unaccentedILIKE; returns everything when the query is blank
Usage
ruby
class Article < ApplicationRecord
include Trek::Pageable
include Trek::Searchable
end
Article.search("élève") # matches "eleve", "Élève"…Controller side
The Trek::Search controller concern wires this into index actions: it filters @objects by params[:search] whenever the model responds to search — that's what powers the search field in admin lists.