Skip to content

Instantly share code, notes, and snippets.

@amolpujari
Created August 2, 2012 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amolpujari/3239786 to your computer and use it in GitHub Desktop.
Save amolpujari/3239786 to your computer and use it in GitHub Desktop.
adding a new alert to the rails app
class TestAlert < AlertComposer
set_alert :name => 'Test alert',
:description => 'budget reached and get alerts',
:level => 'error', # or 'warning', 'danger' or default => 'info'
:flash => true # default false, to ensure system notification is flashed to get attention
def notify receiver, related_id, extra={}
"this is test system alert :) or return nil to avoid"
end
def sms receiver, related_id, extra={}
"this is test sms alert :) or return nil to avoid"
end
def email receiver, related_id, extra={}
UserMailer.test_mail(receiver, 'some dynamic data').deliver
end
end
# example to send alert to a user which gets added to delayed_job
alert @user, :test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment