blob: f85bc343f73feb6408ca5bff4c3f062d03c0ba2f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
class Comment < ActiveRecord::Base
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
|