I am fairly new to rails and trying to learn rails by creating some
projects on my own. I am trying to perform a geo search on a
restaurant model and I am using geokit for that. My model stores the
latitude and longitude for the location.
I am searching for the specified location entered by the user and
getting all the restaurants that are near that location. However I
would also like to apply another filter on the returned result like
returning the restaurant that only serves italian (for example). Here
is a snippet of the code that I using.
@location = Geokit::Geocoders::GoogleGeocoder.geocode
//Using geokit find method to return the restaurants within 2
miles of the specified address
@restaurants = Restaurant.find(:all, :origin => @location, :within
//finally getting the restaurants that serve the user specified
@restaurants = @restaurants.where(“cuisine like ?”,
params[:cuisine]) if params[:cuisine]
This results in an " undefined method `where’ " error.
I am not able to figure out how can I get this to work. I am using
rails3 and ruby 1.9.2.
Any help on this will be greatly appreciated.