blob: 2a8b0b33dfe2e003292ec45b651f82ee7f76dee1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
class Favorite < ApplicationRecord
belongs_to :user
belongs_to :creation, counter_cache: true, touch: true
after_create :create_activity
def create_activity
transaction do
Activity.create(user: creation.author, subject: self)
creation.author.notify_of_activity
end
end
end
|