我有这段代码在页面上显示多个地图:
.row
.span12
- counter = 1
- @users.each do |user|
- map_visits = user.visits.to_gmaps4rails
- unless map_visits.blank?
.span3
%div{ id: "container_#{counter}" }
%div{ id: "map_#{counter}" }
= gmaps(map_options: { zoom: 6, container_id: "container_#{counter}", id: "map_#{counter}" }, markers: { data: map_visits } )
- counter += counter
它返回错误“语法错误,意外的keyword_ensure,期待$ end”,但我无法弄清楚这里有什么问题。 better_errors gem显示代码中3“容器_#{counter}”项的错误。有什么想法吗?
答案 0 :(得分:0)
你有一些不必要的缩进,行 - unless map_visits.blank?
(及其后面的行)不应缩进:
- map_visits = user.visits.to_gmaps4rails
- unless map_visits.blank?
.span3
...