I have a model projects
. And I have a search form with many search bars. What I want is (within the oder searches) a search bar where you can type in two strings. If you want to find all projects regarding "Graphics Card" and "China" you should be able to type in something like graph chin
and all these records will be displayed.
In the Projct
model I have this
def self.google(var1, var2)
where("brief_title LIKE ? and country LIKE ?", "%#{var1}%", "%#{var2}%")
end
In the ProjectsController
I have a bunch of code and tryed the following but it doesn't work (look for google)
bunch of other code
else
@projects = Project.select_stuff(params[:stuff_id]).select_x(params[:x_id]).search(params[:search]).google(params[:var1], params[:var2]).paginate(:per_page => 25, :page => params[:page])
end
Has someone a clue?
Thank you in advance
Aucun commentaire:
Enregistrer un commentaire