我有一个 form 表单,用的是 simple_form
<%= simple_form_for([:admin, @category], :wrapper => :inline) do |f| %>
<% if @category.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@category.errors.count, "error") %> prohibited this category from being saved:</h2>
<ul>
<% @category.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= f.input :name %>
<%= f.input :parent, :collection => Category.all%>
<div class="actions">
<%= f.button :submit %>
</div>
<% end %>
但事提交的时候
ActiveRecord::AssociationTypeMismatch in Admin::CategoriesController#create
Category(#70187922823040) expected, got String(#70187915399620)