How to search based on all locations. Locations are stored in cookie , i want to search and get result like this, list properties in locations Delhi NCR or Mumbai or Pune or Hyderabad or Bangalore or Chennai or Coimbatore or Cochin
i written active record like this
@location = cookies[:location_id] (here iam getting all locations) @properties=Property.where("location LIKE ?", "%#{@location}%")
so that i got sql query like this SELECT * FROM
propertiesWHERE (location LIKE '%Delhi NCR,Mumbai,Pune,Hyderabad,Bangalore,Chennai,Coimbatore,Cochin%')
seperated by comma, and also not getting search result if any location name is present in table. how to search according to all locations and list if any present?
Aucun commentaire:
Enregistrer un commentaire