Class: Fe::Notifier
- Inherits:
-
ActionMailer::Base
- Object
- ActionMailer::Base
- Fe::Notifier
- Defined in:
- app/mailers/fe/notifier.rb
Instance Method Summary collapse
-
#notification(p_recipients, p_from, template_name, template_params = {}, options = {}) ⇒ Object
call Notifier.deliver_notification.
Instance Method Details
#notification(p_recipients, p_from, template_name, template_params = {}, options = {}) ⇒ Object
call Notifier.deliver_notification
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/mailers/fe/notifier.rb', line 5 def notification(p_recipients, p_from, template_name, template_params = {}, = {}) email_template = EmailTemplate.find_by_name(template_name) if email_template.nil? raise "Email Template '#{template_name}' could not be found" else set_format = .delete(:format) mail({to: p_recipients, from: p_from, subject: Liquid::Template.parse(email_template.subject).render(template_params)}.merge()) do |format| case set_format.to_s when 'html' format.html { render html: Liquid::Template.parse(email_template.content).render(template_params) } else format.text { render plain: Liquid::Template.parse(email_template.content).render(template_params) } end end @recipients = p_recipients @from = p_from @subject = Liquid::Template.parse(email_template.subject).render(template_params) @body = Liquid::Template.parse(email_template.content).render(template_params) end end |