apneadiving/Google-Maps-for-Rails — Issue #127: custom infowindow 
Author: bbuegler
Created: 2011-12-07 22:56:05+00:00
State: open

hey i'm sure it's actually not a bug but i've been hurting my head for days now and couldn't get this straightened out. This is most likely due to me being a bloody noob. So here is my problem:

i've been trying to get a custom infowindow - i'm trying to make my first app on Rails 3.1.0 and Ruby 1.8.7.
i've included the <%= yield :scripts %> and skipped the <%= yield :head %> since it's apparently not required in my version.
my address is computing

def gmaps4rails_address
self.user.street + self.user.city
end
and my custom markers are displayed beautifully. i have put together this little piece of code im my controller to show some content in the infowindow and to customise the markers.

def maps
@json = Stuff.all.to_gmaps4rails do |stuff, marker|
marker.infowindow render_to_string(:partial => "/stuffs/mapstuff", :locals => { :stuff => stuff}).gsub(/\n/, '').gsub(/"/, '\"')
marker.picture({
:picture => stuff.image.url(:tiny),
:width => "30",
:height => "30"
})

#marker.description stuff.description
marker.title stuff.title
#marker.sidebar "i'm the sidebar"
marker.json "\"id\": #{stuff.id}"
end
end

it works fine too and even renders the partial.
my problems started when i began modifiying the infowindow by passing the option custom_info_window_class:

<%= gmaps("markers" => {"data" => @json, "options" => { "custom_infowindow_class" => "yellow","randomize" => true, "max_random_distance" => 1000, "clusterer_maxZoom" => 17 }, "map_options" => { "type" => "HYBRID", "auto_adjust" => true,"center_on_stuff" => true }}) %>

it's hard an cruel but at this point my infowindow gets a new class but not the one i'm pasing. Instead it apparently defaults to: infoBox which allows me to do some styling but from this point on there is no content in my infowindow anylonger, besides the little close infowindow x. has anybody a tip for me?