Sha256: acd9206437d4bdc9b0e514d75508b4635867b5defa09e966447ad58ae28e1293
Contents?: true
Size: 846 Bytes
Versions: 1
Compression:
Stored size: 846 Bytes
Contents
module EffectiveEmailTemplatesHelper # We are given a form to essentially send an email def effective_email_review_fields(form, template_name, mail = nil) raise('expected a mail object') if mail && !mail.kind_of?(ActionMailer::MessageDelivery) raise('expected form.object to respond to email_review') unless form.object.respond_to?(:email_review) email_review = form.object.email_review unless email_review&.template_name == template_name.to_s email_template = Effective::EmailTemplate.where(template_name: template_name).first! email_review = Effective::EmailReview.build(email_template: email_template) if mail.present? email_review.body = mail.message.body end end render(partial: 'effective/email_reviews/fields', locals: { email_review: email_review, form: form }) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
effective_email_templates-1.0.11 | app/helpers/effective_email_templates_helper.rb |