Sha256: a2000203e275941a7a141179125c9f1f70dc5b42df86d50d7742d4a7194d4930
Contents?: true
Size: 839 Bytes
Versions: 1
Compression:
Stored size: 839 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 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) end if mail.present? raise('expected a mail object') unless mail.kind_of?(ActionMailer::MessageDelivery) email_review.body ||= mail.message.body 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.10 | app/helpers/effective_email_templates_helper.rb |