Dom
Dom

Reputation: 1486

Rails App Notification Plugins

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

Upvotes: 2

Views: 448

Answers (2)

amitkaz
amitkaz

Reputation: 2712

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

Upvotes: 3

Mike Buckbee
Mike Buckbee

Reputation: 6993

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.

Upvotes: 2

Related Questions