【发布时间】:2015-02-01 12:47:20
【问题描述】:
我正在尝试在 Rails 4 应用程序中实现 country_select gem (gem 'country_select','~> 2.1.0'),但没有成功。这是我表单中的代码。我已经从堆栈上的类似问题尝试了几种排列但没有成功。我不明白为什么我会收到错误 -
"ActionView::Helpers::FormBuilder:0x007fafb5878c48 的未定义方法 `input'>"
请记住,我是 Rails 初学者。
<%= form_for(@user, html: { multipart: true }) do |f| %>
<%= f.label :country %><br>
<%= f.input :country, as: :country %>
<%= f.submit "Update my account", class: "btn btn-primary" %>
<% end %>
我也试过了
<%= f.label :country %>
<%= f.country_select :country %>
来自文档。 “国家”是我的用户属性之一。
欢迎任何关于新手问题的指导。
【问题讨论】:
-
将 :country 添加到用户强参数
标签: ruby-on-rails select country