blob: c7d68c5373aa2a9dbd164106b3050c503a004d77 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
class Favorite < ActiveRecord::Base
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
|