我试图弄清楚为什么当我有一张地图显示地图位置的控制器的 json 字符串时,当我单击信息框并转到特定的 id 页面时,我无法缩放到特定的 id 位置,并保留其余位置在地图上。例如:
显示来自places_controller 的所有点的地图:
def index
@json = Places.all.to_gmaps4rails
end
显示自身的单个 id 页面:
def show
@json = Places.find(params[:id]).to_gmaps4rails
end
我希望 .find(params[:id]).to_gmaps4rails 包含 .all 位置,但以 :id 位置为中心。
ps-索引地图是 geoLocated 并以用户为中心,而显示位置仅以 1 个标记条目为中心。
谢谢!