Use AR callbacks instead of observers (removed in Rails4) for notifications.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12021 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2013-07-14 14:26:27 +00:00
parent 010bfc56e1
commit 205eda8b33
16 changed files with 72 additions and 173 deletions
+10
View File
@@ -22,5 +22,15 @@ class Comment < ActiveRecord::Base
validates_presence_of :commented, :author, :comments
after_create :send_notification
safe_attributes 'comments'
private
def send_notification
if commented.is_a?(News) && Setting.notified_events.include?('news_comment_added')
Mailer.news_comment_added(self).deliver
end
end
end