【发布时间】:2017-01-27 01:48:17
【问题描述】:
我目前正在使用 Rails 构建一个事件应用程序。我正在为事件显示页面实现 Google Maps Embed API 并收到以下错误 -
“Google Maps API 服务器拒绝了您的请求。请求无效。缺少 'q' 参数。”
我安装了地理编码器 gem,包括纬度和经度。对于我的地址,我使用“位置”列并为此目的使用 jquery.autocomplete。这是我的展示页面代码 -
<h3>Location</h3>
<p><%= @event.location %></p>
<iframe
width="600"
height="450"
frameborder="0" style="border:0"
src="https://www.google.com/maps/embed/v1/place?key=<%= ENV["google_maps_api_key"] %>=<%= @event.location %>" allowfullscreen>
</iframe>
我是否仍需要为我的事件模型中的地址使用特定方法来解决此问题?如果是这样,我该如何表达才能使它起作用?
【问题讨论】:
标签: ruby-on-rails ruby google-maps ruby-on-rails-4