ref: master
plugins/tolerance_time/lib/ext/comment.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 |
require_dependency 'comment' class Comment after_create do |comment| ToleranceTimePlugin::Publication.create!(:target => comment) end before_destroy do |comment| publication = ToleranceTimePlugin::Publication.find_by target: comment publication.destroy if publication.present? end end |