1
ActiveAdmin Rails 4谷歌靜態地圖問題 下面的代碼顯示了給定地址的正確緯度和長度,但在googlemap靜態地圖中使用它顯示完全不正確的地圖。任何你能想到的理由?如果我手動將lat和long放入http:map字符串中,則會顯示正確的地圖。Rails - 不正確的谷歌靜態地圖 - 拉特長期正確的給定地址 - 活動管理 - image_tag
ActiveAdmin.register Address do
permit_params :address, :longitude, :latitude
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
#
# or
#
# permit_params do
# permitted = [:permitted, :attributes]
# permitted << :other if resource.something?
# permitted
# end
index do
selectable_column
id_column
column :address
actions
end
filter :address
form do |f|
f.inputs "Address Details" do
f.inputs :address
end
f.actions
end
show do
attributes_table do
# other rows
row :address
row :latitude
row :longitude
content do
render 'googlemap'
end
row :addressMap do
image_tag "https://maps.googleapis.com/maps/api/staticmap?center=#{:latitude},#{:longitude}&zoom=13&size=600x300&maptype=roadmap"
end
end
end
end