# Mailmodel # Copyright (c) 2007 David N. Welton ) cattr_accessor :sender_address @@destination_address = [] cattr_accessor :destination_address self.template_root = "#{File.dirname(__FILE__)}/../views" def report(operation, model) @subject = "Notification: #{operation}d #{model.class}" @recipients = @@sender_address @from = @@destination_address @sent_on = Time.now @headers = {} @model_data = pprint(model) @body = {:model => model, :sent_on => @sent_on, :data => @model_data} end def template_root "#{File.dirname(__FILE__)}/../views" end end def mail_model() operation = 'save' Modelmailer.deliver_report(operation, self) end end