class Mailtime::MailTemplateCollection

Attributes

templates[R]

Public Class Methods

new(mail) click to toggle source
# File lib/mailtime/active_record/models/mail_template.rb, line 15
def initialize(mail)
  @mail = mail
  @templates = Mailtime::MailTemplate.includes(:mail_layout).
      where(:klass => mail.class.to_s, :action => mail.action_name)
end

Public Instance Methods

html() click to toggle source
# File lib/mailtime/active_record/models/mail_template.rb, line 21
def html
  _template = @templates.where(:format => 'html').first
  return _template if _template
  Mailtime.configuration.fallback ? nil : NullHTMLTemplate.new(@mail)
end
text() click to toggle source
# File lib/mailtime/active_record/models/mail_template.rb, line 27
def text
  _template = @templates.where(:format => 'text').first
  return _template if _template
  Mailtime.configuration.fallback ? nil : NullTextTemplate.new(@mail)
end
Also aliased as: txt
txt()
Alias for: text