Q:

Active Record search in Ruby for certain text pattern

Let's say, I have class Person with a field 'full_name'.  How can I find all records where this field includes pattern 'smith'? 

A:

You can use Sql like or ilike queries
Edit as per @Vaibhav Kaushal comment
Person.where("full_name LIKE ?", "'% smith%'")

For MySQL database,
Person.where("full_name  RLIKE ?", ' smith')

If you want to use OR i.e. find Person objects having full_name matching 'smith', 'roger' or 'dwane', you can use below,
Person.where("full_name  RLIKE ?", ' smith | roger | dwane')

