Ruby on rails 钢轨名称过路机';国家选择';

Ruby on rails 钢轨名称过路机';国家选择';,ruby-on-rails,ruby,activerecord,Ruby On Rails,Ruby,Activerecord,所以,我得到这个错误,我不知道为什么,因为它应该工作,因为在我的模式国家是一个字符串 这是我的密码: <%= simple_form_for(@studentapplication) do |f| %> <%= f.error_notification %> <div class="form-inputs" id="session-form"> <%= f.input :first_name, required: true,

所以,我得到这个错误,我不知道为什么,因为它应该工作,因为在我的模式国家是一个字符串

这是我的密码:

<%= simple_form_for(@studentapplication) do |f| %>
    <%= f.error_notification %>

    <div class="form-inputs" id="session-form">
      <%= f.input :first_name, required: true, autofocus: true, placeholder: "First Name", label:false %>
      <%= f.input :last_name, required: true, autofocus: true, placeholder: "Last Name", label:false %>
      <%= f.input :email, required: true, autofocus: true, placeholder: "Email", label:false %>
      <%= f.input :sex, required: true, autofocus: true, placeholder: "Sex", label:false %>
      <%= f.input :country, required: true, autofocus: true, placeholder: "Country", label:false %>
      <%= f.input :city, required: true, autofocus: true, placeholder: "City", label:false %>
    </div>

  <%= f.button :submit, "Apply", class: "student-bordered" %>
<% end %>

当您有一个字段名“country”时,简单表单将尝试使用country\u select。您可以通过使用以下代码来覆盖它

<%= f.input :country, as: :text %>

有趣的谢谢你,我不知道。效果很好。你能解释一下第二个吗?我这样做了,但它仍然给了我错误。第一个成功了!在simple_form.rb文件中添加config.input_mappings={/country/=>:string}后,应该重新启动rails服务器,以便在代码中反映出来。
<%= f.input :country, as: :text %>
config.input_mappings = { /country/ => :string }