【发布时间】:2012-06-28 05:05:11
【问题描述】:
我有一个模型: 班级简介 包括 Mongoid::Document
# PROFILE TYPE KIDS & PARENT
embeds_one :kids_type, :class_name => "ProfileKidsType"
embeds_one :parent_type, :class_name => "ProfileParentType"
end
在 ProfileKidsType 模型中:
class ProfileKidsType
include Mongoid::Document
field :nickname, :type => String
field :gender, :type => String
....等等......
embedded_in :profile, :inverse_of => :kids_type
end
在 意见:个人资料/_form.html.haml
= form_for @profile do |f|
.formBox
.formSection Child information
= f.label :lname, "Nick name"
= f.text_field :nickname
我如何在这里访问昵称字段.....当我执行上面的代码时,它说的是未定义的方法。
【问题讨论】:
标签: ruby-on-rails mongodb