使用Formtastic预先检查用作复选框的模型对象的集合

|| 因此,我有一些要作为集合传递的对象:
@things = Thing.all
在我看来:
<%= f.input :things, :collection => @things, :as => :check_boxes %>
有什么方法可以指定在加载视图时应该检查哪些对象? 谢谢!     
已邀请:
        在控制器的\“ new \”操作中,您想使用默认值初始化表单对象:
def new
  @post = Post.new
  @post.things = [@one_thing, @another_thing]
end
这也可以通过模型本身中的“ 3”钩完成。     

要回复问题请先登录注册