回调队列Rails

时间:2015-07-04 18:43:39

标签: ruby-on-rails callback

class Post < ActiveRecord::Base
    has_many :comments, dependent: :destroy
    before_destroy :post_method1
    after_destroy  :post_method2
end


class Comment < ActiveRecord::Base
    belongs_to :post
    after_destroy :comment_method
end

post.destroy之后(if post.comments.any? = true)之后,如何在两个模型中对回调和销毁方法进行排序?

0 个答案:

没有答案