app/models/voltron/notification/email_notification.rb in voltron-notify-0.1.5 vs app/models/voltron/notification/email_notification.rb in voltron-notify-0.1.6
- old
+ new
@@ -72,10 +72,16 @@
def arguments(*args)
@mailer_arguments = *args
end
+ def template(fullpath)
+ parts = fullpath.split("/")
+ self.template_name = parts.pop.sub(/\.(html|text)\..*$/, "")
+ self.template_path = parts.join("/")
+ end
+
# TODO: Move this to actual validates_* methods
def error_messages
output = []
output << "recipient cannot be blank" if to.blank?
output << "subject cannot be blank" if subject.blank?
@@ -89,11 +95,11 @@
end
def mail
# If no mailer arguments, use default order of arguments as defined in Voltron::NotificationMailer.notify
if @mailer_arguments.blank?
- @request << { to: to, from: from, subject: subject }.compact.merge(vars: vars, attachments: attachments)
- mailer.send method, { to: to, from: from, subject: subject }.compact, vars, attachments
+ @request << { to: to, from: from, subject: subject, template_path: template_path, template_name: template_name }.compact.merge(vars: vars, attachments: attachments)
+ mailer.send method, { to: to, from: from, subject: subject, template_path: template_path, template_name: template_name }.compact, vars, attachments
else
@request << @mailer_arguments.compact
mailer.send method, *@mailer_arguments.compact
end
end
\ No newline at end of file