I have a search form that searches multiple columns within my recipe model, at the moment it returns results on full string basis only so if i search lasagne I get a result, however if I search lasa then i get nothing returned. Am i correct in thinking that rather that do a = ? search i need to do a LIKE search? If so I am unsure of the syntax to achieve this.
My current query looks like this
@countrysearch = Recipe.where("dish_name = ? OR country_of_origin = ? OR difficulty = ? OR preperation_time = ?",
params[:search],
params[:search],
params[:search],
params[:search]
)
What do i need to do to get this to search by partial text? or can someone point me to a resource that will advise what syntax to use?
Any help appreciated
thanks
ok think I have found the answer, though if anyone has a better solution please advise
Within the controller I now have
)