我有两个模型
class Supplier < User
include Mongoid::Document
embeds_many :images
accepts_nested_attributes_for :images
end
class Image
include Mongoid::Document
embedded_in :supplier
end
当我以嵌套形式保存图像时,它会保存在供应商集合中,即
s = Supplier.first
s.images #some Image records
但问题是图像收集本身仍然是空的,即
Image.count # gives 0