2009-09-11 44 views
0

每当注册用户更新他们的个人资料时,我希望管理员收到关于此的电子邮件通知。导轨通知

在Drupal的通知模块将做到这一点需要

怎么能在这个轨道办呢?

回答

4

结账ActiveRecord::Observer

class UserObserver < ActiveRecord::Observer 
    observe :userprofile 
    def after_save(userprofile) 
     Notifier.deliver_comment("[email protected]", "The profile for #{userprofile.username} has changed.", userprofile) 
    end 
end 
+0

这是使用ActionMailer(http://api.rubyonrails.org/classes/ActionMailer/Base.html)来做实际的电子邮件发送。 – mikej 2009-09-11 11:11:42

+0

感谢您的清理! – 2009-09-11 11:34:53