diff options
| author | mo khan <mo@mokhan.ca> | 2014-01-18 22:54:37 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-01-18 22:54:37 -0700 |
| commit | e0ce9c098d0b82e2ae999b4e80f11c82fa65f78d (patch) | |
| tree | 7ca8fd4e6a1dde56c10a7032860a5d3732a9e42c /app/models/comment.rb | |
| parent | a8ccb349d975166ff33935b19548018eeb4f24f7 (diff) | |
create a new activity when a comment is created.
Diffstat (limited to 'app/models/comment.rb')
| -rw-r--r-- | app/models/comment.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/comment.rb b/app/models/comment.rb index 05cf9954..72b4dc5c 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -1,4 +1,12 @@ class Comment < ActiveRecord::Base belongs_to :user belongs_to :creation + has_many :activities, as: :subject + after_create :create_activity + + private + + def create_activity + Activity.create(user: user, subject: self) + end end |
