views:

101

answers:

2

Hi

Can anyone recommend some rails plugins that would allow me to register various notification against models that could be linked to a set of templates to format emails (and possibly other).

Ideally the plugin could be referenced in one line from each model and the notification format could be passes from some construct such as user preference etc..

Appreciate your help

Dom

+1  A: 

I'm not sure why you would need a plugin for this as it can be accomplished with ActiveRecord Callbacks, setup a callback in each model like

after_save :send_notifications

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

You'll need to roll your own interface for creating and choosing the HTML templates if it's not something dictated by the logic of your application.

Mike Buckbee
+2  A: 

observational is a nice way of... observing :)

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

  def welcome_email(user)
  end
end
amikazmi