I want my code to do two things that is currently not doing
@students = Student.where(["first_name = ? OR middle_name = ? OR last_name = ?", params[:query].split])
-
Work. (it says im supposed to pass 4 parameters but I want the user to be able to type words and find by those words on each of those fields and return whatever matches)
-
Actually use Like clause instead of rigid equal clause.
Please Help.
This looks like a problem that would be better suited to using search rather than SQL. Have you considered something like thinking sphinx or act as ferret (solr would probably be overkill).
…if you must do this in sql, you could build a query something like this: