Wednesday, 2 October 2013

Search multine issue

Search multine issue

Hello i'm doing a search by multi lines
Here is my table
PEOPLE
|id| |name| |lastname1|
integer varchar(255) varchar(255)
|1| |Michael New Rails| |Morote|
|2| |Charles Chris Angels| |Flowers|
|3| |Gabriel Francis James| |Owen|
Here is my controller
@people = Person.find(:all,:conditions => ["( name LIKE ? OR
lastname1 LIKE ? OR
(concat(name, \" \", lastname1) LIKE ? )
)" ,
"%#{params[:query]}%",
"%#{params[:query]}%",
"%#{params[:query]}%" ])
But is not working properly
Someone can help me to search by whatever order in the name like me example?
I will really appreciate help

No comments:

Post a Comment