module ActsAsMailable::EmailTemplate::Finders

Public Instance Methods

find_email_templates_for_mailable(mailable_str, mailable_id) click to toggle source

Helper class method to look up all email_templates for mailable class name and mailable id.

# File lib/email_template_methods.rb, line 19
def find_email_templates_for_mailable(mailable_str, mailable_id)
  where(["mailable_type = ? and mailable_id = ?", mailable_str, mailable_id]).order("created_at DESC")
end
find_mailable(mailable_str, mailable_id) click to toggle source

Helper class method to look up a mailable object given the mailable class name and id

# File lib/email_template_methods.rb, line 25
def find_mailable(mailable_str, mailable_id)
  model = mailable_str.constantize
  model.respond_to?(:find_email_templates_for) ? model.find(mailable_id) : nil
end