Sha256: 629b341c7c643c604a080deff02131ce6f8e63fcb1a5919d1080d32f2279f400
Contents?: true
Size: 811 Bytes
Versions: 10
Compression:
Stored size: 811 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 protected def ensure_body_field_presence self.html_body = self.html_body.presence || '' self.text_body = self.text_body.presence || '' end end
Version data entries
10 entries across 10 versions & 1 rubygems