新手问题 mongo mapper 嵌套的文档如何写 form_for

itsvoid · September 06, 2012 · 2592 hits

有一个 model,outer,其有嵌套文档 specification,annotations,comments,我现在想用 form_for @outer,传统数据库,可以用 symbol,这样写: <%= f.label :name, "名称", class: 'control-label' %> 嵌套的该怎么写呢? <%= f.label @outer.specification.title.to_sym, "名称", class: 'control-label' %>

class Outer include MongoMapper::EmbeddedDocument key :author_uid, ObjectId, required: true key :name, String one :specification

many :annotations

many :comments timestamps!

end

No Reply at the moment.
You need to Sign in before reply, if you don't have an account, please Sign up first.