Mongoid的嵌套表单出错 [英] Having an error with nested forms with Mongoid

查看:47
本文介绍了Mongoid的嵌套表单出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Rails 3上使用Mongoid并尝试构建嵌套表单.我遇到的问题是当我使用accept_nested_attributes_for方法时,出现以下错误消息:

I am using Mongoid on Rails 3 and trying to build a nested form. The problem I run into is when I used accept_nested_attributes_for method, I get this error message:

undefined method `persisted?' for []:Array

还有其他人对Mongoid中的嵌套表单有疑问吗?我该怎么解决?

Is anyone else having problem with nested forms in Mongoid? What can I do to fix it?

有关该错误的更多信息.这是完整的痕迹.

more about the error. This is the full trace.

mongoid (2.0.0.beta.19) lib/mongoid/criteria.rb:156:in `send'
mongoid (2.0.0.beta.19) lib/mongoid/criteria.rb:156:in `method_missing'
mongoid (2.0.0.beta.19) lib/mongoid/associations/references_many.rb:113:in `send'
mongoid (2.0.0.beta.19) lib/mongoid/associations/references_many.rb:113:in `method_missing'
actionpack (3.0.1) lib/action_view/helpers/form_helper.rb:1280:in `fields_for_nested_model'
actionpack (3.0.1) lib/action_view/helpers/form_helper.rb:1273:in `fields_for_with_nested_attributes'
actionpack (3.0.1) lib/action_view/helpers/form_helper.rb:1155:in `fields_for'
simple_form (1.2.2) lib/simple_form/action_view_extensions/builder.rb:96:in `simple_fields_for'
app/views/users/profile.html.haml:16:in `_app_views_users_profile_html_haml__599717908_2187897020_0'

推荐答案

此问题已由最近的通过眨眼在Github中找到我的拉动请求.

这篇关于Mongoid的嵌套表单出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆