Sha256: 14fa6c6797ab6da80bbba904cab104d3f9b1426ee6be5f10289f4cab1f8c16ce

Contents?: true

Size: 656 Bytes

Versions: 2

Compression:

Stored size: 656 Bytes

Contents

# An "Email" that isn't intended to be sent, but rather as a prototype
# for other Emails to be generated from.
#
class EmailTemplate < Email
  # TODO the email class hierarchy needs a major refactoring, it's backwards and convoluted
  before_save :generate_html_body_from_text_body

  validates :from_email, :email => { :allow_blank => true }

  def as_json(options = {})
    {}.tap do |hash|
      hash[:to]        = recipient.email
      hash[:reply_to]  = reply_email
      hash[:from]      = from_email
      hash[:subject]   = render(:subject)
      hash[:html_body] = render(:html_body)
      hash[:text_body] = render(:text_body)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
e9_crm-0.1.16 app/models/email_template.rb
e9_crm-0.1.14 app/models/email_template.rb