版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出版、作者信息和本声明。否则将追究法律责任。 http://blog.csdn.net/topmvp - topmvp In test driven development, you first write an executable test of what your application code must do. Only
我有以下型号 class Order < AR::Base
has_many :products
accepts_nested_attributes_for :products
end
class Product < AR::Base
belongs_to :order
has_and_belongs_to_many :stores
accepts_nested_attr
我的嵌套模型形式在第一层次上工作很好.但是我的印象是,你可以使用acceptance_nested_attributes_for深入许多层次.但是当我尝试下面的代码时,“ Image”属性被附加到顶层的“问题”模型,并且在使用未知属性“Image”错误的表单提交时中断. 我可以使用表单数据手工完成所有的插入,但如果Rails可以自动处理,那么明显的原因会更好. 我究竟做错了什么?我试过改变| af