I implemented the geocoder gem based on the tutorial on http://railscasts.com/episodes/273-geocoder
This is a part of the house show view template
- @house.location.nearbys(20, {:order => :distance, :units => :km}).each do |house|
%li
= link_to house.name, house_path
(#{city.distance.round(2)} KM)
This show al other houses with the distance in KM, so this works fine.
I already showed on the same house page all the cities of the region where the house is located, like this:
%ul.tags
- @region.cities.each do |city|
%li= link_to city.name, country_region_city_path(@country, @region, city)
Question: How can i implement the geocoder gem in the @region.cities loop so the visitor can see on the house page how many KM is it to drive from the house to the cities?
Thanks...remco