Hi all,

I've installed the ym4rgm plugin so that I can integrate a google map to
pinpoint locations of photos. I cant find where the error refers to.
I got the API key from google for http://localhost and put it into
config/gmaps_api_key (development and test).

The error is:
undefined method `relative_url_root' for ActionController::Base:Class
Extracted source (around line #2):
1: <% content_for :head do %>
2:   <%= GMap.header %>
3: <% end %>
4:




My photos_controller show method is:

 def show
    @photo = Photo.find_by_user_id_and_id(params[:user_id],
                                          params[:id],
                                          :include => :user)
    if @photo.show_geo && (@photo.geo_lat && @photo.geo_long)
      @map = GMap.new("map_div_id")
      @map.control_init(:map_type => false, :small_zoom => true)
      @map.center_zoom_init([...@photo.geo_lat, @photo.geo_long], 8)

      marker = GMarker.new([...@photo.geo_lat, @photo.geo_long],
                           :title => @photo.title,
                           :info_window => @photo.body)
      @map.overlay_init(marker)
    end
    respond_to do |format|
      format.html # show.rhtml
      format.xml  { render :xml => @photo.to_xml }
    end
  end

The code for displaying the embedded map (show) is:

<% content_for :head do %>
  <%= GMap.header %>
<% end %>

<%= image_tag @photo.public_filename, :id => 'photo' %>

<% if @map %>
  <div id="gmap">
    <%= link_to_function 'Hide Map',
          "Element.hide('gmap'); Element.show('showmaplink')" %>
    <%= @map.to_html %>
    <%= @map.div(:width => 650, :height => 200) %>
    <br />
  </div>
  <%= link_to_function 'Show Map',
        "Element.show('gmap'); Element.hide('showmaplink')",
        :id => 'showmaplink',
        :style => 'display:none' %>
<% end %>
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to