class Person
include Mongoid::Document
field :name
embeds_many :addresses
end
class Company
include Mongoid::Document
field :name
embeds_many :addresses
end
class A
我想知道是否有辦法在Mongoid映射器中的嵌入式對象上觸發after_save回調。 例子: i = Image.new(:file => file)
user.images << i
# => i.after_save should be triggered here
我知道,如果我的話後致電i.save,它會火,但是真的很難記住,做在我的代碼。 此外,調用user.images.cr