geocode my location and display with google-maps-for-rails gem
i want to geocode my location and display with google-maps-for-rails gem
view:
= gmaps({ "map_options" => { "auto_adjust" => true } })
= form_tag geocode_geo_locations_path, :method => :get, :remote => true do
= text_field_tag 'address'
= submit_tag 'search'
in my controller i have:
def geocode
@locati开发者_如何学运维on = Gmaps4rails.geocode(params[:address])
if @location
@location_hash = @location.map { |loc| {:longitude => loc[:lng], :latitude => loc[:lat], :address => loc[:matched_address]} }.first
end
end
and in the view geocode.js.erb
Gmaps4Rails.replace_markers(<%=raw @location_hash.to_json %>);
it work so far, that i get a marker on the map, however the map doesnt get auto_adjusted . how can i accomplish that??
Ok... Indeed you just noticed a bug :)
Corrected now in 0.8.2.
Thanks!
精彩评论