I have 3 tables: Objects , Locations , Hotels .
Each object has multiple locations, and each location has several hotels (20 miles by default radius).
My models (simplified it a bit to focus on the main things)
object.rb
attr_accessible :name has_many :locations has_many :hotels
location.rb
attr_accessible :name, :address, :longitude, :latitude has_many :objects has_many :hotels
hotels.rb
attr_accessible :name, :address, :longitude, :latitude has_many :objects has_many :locations
I want to create a search form where the user can enter Object name and search radius .
The exit should be a list of all hotels located within a given radius (less than or equal to 20 miles) from the center of each place, which corresponds to the object.
I want to use the geocoding gem method , but I'm not sure how to build the controller level of such a task.

source share