2009-09-03 36 views
2

誰能推薦一些Rails插件,讓我來對抗可能與一組模板格式的電子郵件(可能還有其他)機型註冊各種通知。Rails應用程序通知插件

理想的插件可以從每個模型一行,並通知格式可以從一些構造通行證如用戶偏好等被引用..

感謝您的幫助

大教堂

+0

已搜索插件目錄這裏.. HTTP://agilewebdevelopment.com/...沒有運氣 – Dom 2009-09-03 14:39:47

回答

3

observational是一個很好的方式......觀察:)

class Notifier < ActionMailer::Base 
    observes :user, :after => :create, :invokes => :deliver_welcome_email 

    def welcome_email(user) 
    end 
end 
2

我不知道爲什麼你需要一個插件,因爲它可以用ActiveRecord Callbacks完成,在每個模型中設置回調,如

after_save :send_notifications 

def send_notifications 
    Notifier.deliver_signup_notification(template, user) # sends the email 
end 

你需要推出自己的界面,用於創建和選擇HTML模板,如果它不是你的應用程序的邏輯決定的。