Class: Commontator::CommentObserver
- Inherits:
-
ActiveRecord::Observer
- Object
- ActiveRecord::Observer
- Commontator::CommentObserver
- Defined in:
- app/models/commontator/comment_observer.rb
Instance Method Summary collapse
Instance Method Details
#after_create(comment) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'app/models/commontator/comment_observer.rb', line 3 def after_create(comment) thread = comment.thread thread.subscribe(comment.creator) if thread.config.auto_subscribe_on_comment thread.add_unread_except_for(comment.creator) recipients = thread.active_subscribers.reject{|s| s == comment.creator} SubscriptionsMailer.comment_created(comment, recipients).deliver \ unless recipients.empty? end |