2011-05-04 68 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更正。

谢谢!