app/helpers/application_helper.rb
# Returns HTML for a Google map containing the +locatable_items+.
#
# Adapt the gmaps_on_rails plugin to talk to our locatable items.
# Return markup containing a Google map with markers for these items, or
# nil if no items have locations.
# - "locatable_items" can be one item or an array of them.
# - A locatable item is anything that responds_to? :location and
#   :title (yes, our Events and Venues both qualify).
# - A locatable item with a nil location will be ignored
#
# The plugin uses Google Maps automatic zooming to set the scale, but
# the little overview map obscures such a big chunk of the main map that
# it's likely to hide some of our markers, so it's off by default.
Returns HTML for a Google map containing the +locatable_items+.
Adapt the gmaps_on_rails plugin to talk to our locatable items.
Return markup containing a Google map with markers for these items, or
nil if no items have locations.
"locatable_items" can be one item or an array of them.
A locatable item is anything that responds_to. :location and
:title (yes, our Events and Venues both qualify).
A locatable item with a nil location will be ignored

The plugin uses Google Maps automatic zooming to set the scale, but
the little overview map obscures such a big chunk of the main map that
it's likely to hide some of our markers, so it's off by default.
Returns HTML for a Google map containing the + locatable_items + . Adapt the gmaps_on_rails plugin to talk to our locatable items . Return markup containing a Google map with markers for these items or nil if no items have locations . " locatable_items " can be one item or an array of them . A locatable item is anything that responds_to . : location and : title ( yes our Events and Venues both qualify ) . A locatable item with a nil location will be ignored The plugin uses Google Maps automatic zooming to set the scale but the little overview map obscures such a big chunk of the main map that it ' s likely to hide some of our markers so it ' s off by default .
def google_map(locatable_items, options={})
    return nil if defined?(GoogleMap::GOOGLE_APPLICATION_ID) == nil
    options[:controls] = [:zoom, :scale, :type] 
    map = GoogleMap.new(options)
    icon = GoogleMapSmallIcon.new('green')
    [locatable_items].flatten.each do |locatable_item|
      location = locatable_item.location
      if location
        map.markers << GoogleMapMarker.new(:map => map,
          :lat => location[0], :lng => location[1],
          :html => link_to(locatable_item.title, locatable_item),
          :icon => icon)
      end
    end
    map.to_html + map.div(nil) unless map.markers.empty?
  end
def google_map ( locatable_items , options = { } ) return nil if defined? ( GoogleMap :: GOOGLE_APPLICATION_ID ) == nil options [ :controls ] = [ :zoom , :scale , :type ] map = GoogleMap . new ( options ) icon = GoogleMapSmallIcon . new ( 'green' ) [ locatable_items ] . flatten . each do | locatable_item | location = locatable_item . location if location map . markers << GoogleMapMarker . new ( :map => map , :lat => location [ 0 ] , :lng => location [ 1 ] , :html => link_to ( locatable_item . title , locatable_item ) , :icon => icon ) end end map . to_html + map . div ( nil ) unless map . markers . empty? end
Returns HTML for a Google map containing the +locatable_items+.
Returns HTML for a Google map containing the + locatable_items + .
# the default, minus :overview # Make the map and our marker(s)
locatable_items
options