Module: ActsAsEmailForm

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/acts_as_email_form.rb

Overview

ActsAsEmailForm Adds an email_form_skip, email_form_from, email_form_subject, email_form_body attr_accessors And some helpful methods to render and validate a Email to Send form That should work with or without effective_email_templates to send an email on a model

Defined Under Namespace

Modules: Base, ClassMethods

Instance Method Summary collapse

Instance Method Details

#email_form_defaults(action) ⇒ Object

Only considered when not using an effective email template



68
69
70
# File 'app/models/concerns/acts_as_email_form.rb', line 68

def email_form_defaults(action)
  { from: nil, subject: nil, body: nil, content_type: 'text/plain' }
end

#email_form_paramsObject

Instance methods



59
60
61
# File 'app/models/concerns/acts_as_email_form.rb', line 59

def email_form_params
  { from: email_form_from, subject: email_form_subject, body: email_form_body }.compact
end

#email_form_skip?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'app/models/concerns/acts_as_email_form.rb', line 63

def email_form_skip?
  EffectiveResources.truthy?(email_form_skip)
end