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