Implementing a Basic Fuzzy Search with Rails
As mentioned in the Introduction, Shine will be sharing a database with an existing customer-facing application. The customer-search feature we’re building will search one of the tables in that database.
In the real world, our database would already exist and you’d hook up to it directly. Since that’s not the case, you’ll need to simulate its existence by creating the table in Shine’s database. And, because you’ll use Postgres query performance optimization, our table is going to need a lot of data in it.
Set Up the New Table and Data
If you were using an existing table, you wouldn’t need a migration—you could just create the Customer model and be done. That’s not the case (since this is an example ...
Get Rails, Angular, Postgres, and Bootstrap, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.