As usual, this is just a diary of what problems being encountered during the process.
Using Trigram in
As mentioned, we need a
pg_search gem. The problem is with this article, which misled me to enable the extension in the same gem.
**Ultimately, make another migration that specifically create this extension.
rails generate migration AddPgTrgmExtensionToDB
class AddPgTrgmExtensionToDb < ActiveRecord::Migration[7.0] def change enable_extension :pg_trgm end end
after you’ve created the database (not sure about before, though, didn’t try). Refer to this older article (which have outdated rails, but generally the flow and steps still works quite well!)
And additionally, don’t use own method when
pg_search gem is available, like in that article.