Rails: How to find_by a field containing a certain string
I think something like this should work:
Topic.where("name like ?", "%apple%")
To accomodate for your edit:
Topic.where("name like ?", "%#{@search}%")
Basic string interpolation, you're using the value of @search
inside the string %%
, so you @search = "apple"
then you end up with %apple%