class Category
  include Mongoid::Document
  include Mongoid::Paperclip
  include Mongoid::Tree
  include Mongoid::Tree::Ordering
  field :title, :type => String
  field :desc,  :type => String, :default => ''
  has_many :books, :autosave => true
  has_mongoid_attached_file :img
  attr_accessible :img, :books_attributes, :title, :desc
  accepts_nested_attributes_for :books, :allow_destroy => true
end
.page-model-form
  = form_for @category do |f|
    .field.need
      %label title
      =f.text_field :title
    .field
      %label desc
      =f.text_field :desc
    .feild
      %label img
      =f.file_field :img
    .field.books
      .book
        - book = @category.books.build
        = f.fields_for :books, book do |book_form|
          %label name
          =book_form.text_field :name
          %label desc
          =book_form.text_field :desc
    .field
      =f.submit
一份问卷中,有多道题的模型