【发布时间】:2015-05-24 03:57:12
【问题描述】:
ActiveAdmin Rails 4 Google 静态地图问题 下面的代码显示了给定地址的正确经纬度,但在 googlemap 静态地图中使用时,它显示的地图完全不正确。你能想到什么理由吗?如果我手动将 lat 和 long 放入 http:map 字符串中,则会出现正确的地图。
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
【问题讨论】:
标签: ruby-on-rails google-maps activeadmin google-static-maps