how to hook for destroy of a model that belongs to another model?
问题 I have a User model which has_many experiments: class User < ActiveRecord::Base has_many :experiments, :dependent => :destroy and Experiment model: class Experiment < ActiveRecord::Base belongs_to :user has_attached_file :thumbnail I want to hook for destroy moment at the Experiment model after the owner User get destroyed. (ex user cancel his account) I need to do so to delete the attachment image of the Experiment model, which is stored at amazon. like experiment.thumbnail.destroy What is