2011-05-04 62 views
3

我要進行地址解析我的位置,並顯示與谷歌,地圖換軌寶石地理編碼我的位置,並顯示與谷歌,地圖換軌寶石

觀點:

= gmaps({ "map_options" => { "auto_adjust" => true } }) 
= form_tag geocode_geo_locations_path, :method => :get, :remote => true do 
    = text_field_tag 'address' 
    = submit_tag 'search' 
在我的控制器

我有:

def geocode 
@location = Gmaps4rails.geocode(params[:address]) 
if @location 
    @location_hash = @location.map { |loc| {:longitude => loc[:lng], :latitude => loc[:lat], :address => loc[:matched_address]} }.first 
end 
end 

並在視圖geocode.js.erb

Gmaps4Rails.replace_markers(<%=raw @location_hash.to_json %>); 

它的工作到目前爲止,我在地圖上得到一個標記,但地圖不會auto_adjusted。 我怎麼能做到這一點?

回答

1

好吧......的確你剛剛注意到了一個bug :)

現在在0.8.2更正。

謝謝!