错误:undefined method `options' for #Mongoid::Relations::Metadata:0x00000003742388
基于 mongoid
在 User 模型中
has_and_belongs_to_many :group
在 Group 模型中
has_and_belongs_to_many :user
表单视图
<%= simple_form_for(@group) do |f| %>
<% if @group.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@group.errors.count, "error") %> prohibited this group from being saved:</h2>
<ul>
<% @group.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= f.label :name, :label => '名称' %>
<%= f.input_field :name %>
<%= f.association :user %>
<%= f.button :submit, :value => '创建用户组' %>
<% end %>
出错在这一句
<%= f.association :user %>