I developp a rails app with an autocomplete address using google maps API, for my rooms. The problem is when I try to type inside my product input adress form.. sometimes I have adress suggestion.. sometimes not! And when I have the suggestion, after clicking on it; it does not record my click in the box. In my rails console I checked if I have the lattitude and longitude for my product: but nothing is recorded. On my Google developper console, I have a Google API activated, with the same id: - Google Maps Javascript API key: active; not recording activity - Google Places for web API Key: active ; recording activity I use figaro to hide my keys. After hours of testing I don't manage to make it work and it makes me crazy.. For info I use an other autocomplete for the same project in my home page. And it works perfectly!
For info: I have the following error in my js console for my view: You have exceeded your daily request quota for this API And I have no error in my js console for my home page (they use the same API)
Thks for help, here is my code:
My script is in my layout:
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=<%= ENV['GOOGLE_API_KEY'] %>&libraries=places"></script>
<%= javascript_include_tag 'application' %>
<%= javascript_pack_tag 'application' %>
My view:
<div class="row">
<div class="col-md-3">
<%= render 'room_menu' %>
</div>
<div class="col-md-9">
<div class="panel panel-default">
<div class="panel-heading">
Location of the bottle
</div>
<div class="panel-body">
<div class="container">
<%= form_for @room do |f| %>
<div class="row">
<div class="form-group">
<label>Address of the bottle</label>
<%= f.text_field :address, placeholder: "Where is the bootle?", class: "form-control", required: true, id: "autoaddress" %>
</div>
</div>
<div class="text-center">
<%= f.submit "Save", class: "btn btn-form" %>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
<script>
$(function() {
$("#autoaddress").geocomplete();
})
</script>
答案 0 :(得分:0)
出现错误import glob
for file in glob.glob("/Users/my_user_name/Downloads/**/*", recursive=True):
print(file)
的原因是,您尚未为帐户设置You have exceeded your daily request quota for this API
。
您必须为您的项目启用计费帐户。为此,您可以参考this
答案 1 :(得分:0)
好吧,经过多次尝试... 我确认要在我的首页和产品位置上执行自动填充功能 您需要至少在Google云上为开发者订阅一个免费帐户。 现在对我来说很好