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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user