【发布时间】:2013-12-09 12:23:00
【问题描述】:
这是我的模型:
class Country
include Mongoid::Timestamps
has_many :cities, after_add: :show_log, after_remove: :show_log
def show_log
puts "this is log!"
end
end
在控制台中:
Country.first.cities.create FactoryGirl.attributes_for(:city)
=> [.....] this is log!
Country.first.cities.first.destroy
=> true
正如您在第二个中看到的,没有记录任何内容! mongoid after_remove 有什么问题?
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 mongoid