【发布时间】:2020-01-30 09:24:07
【问题描述】:
如何在 Rails 中为我的表单创建位置字段?我希望用户能够创建一个有地址的帖子,我已经有了标题和描述字段,但是我遇到了位置字段。我需要使用这些参数(我很困惑将它们放在表单中的哪个位置):
params.require(:location).permit(:name, :formatted_address, :city, :state,
:zip, :latitude, :longitude,
:google_location_id)
end
#and these are the fields I already have
<p>
<%= form.label :title %> <br>
<%= form.text_field :title, class: 'form-control' %>
</p>
<p>
<%= form.label :details %> <br>
<%= form.text_area :details, :cols => "10", :rows => "7", class: 'form-control' %>
</p>
【问题讨论】:
标签: ruby-on-rails forms geolocation location