master
 1class Comment < ApplicationRecord
 2  belongs_to :user
 3  belongs_to :creation
 4  has_many :activities, as: :subject, dependent: :destroy
 5  after_create :create_activity
 6
 7  private
 8
 9  def create_activity
10    transaction do
11      Activity.create(user: creation.author, subject: self)
12      creation.author.notify_of_activity
13    end
14  end
15end