Class: Journeybook::FormSubmissionsController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/journeybook/form_submissions_controller.rb

Defined Under Namespace

Classes: SubmissionError

Constant Summary collapse

FORM_FIELDS =
%w[firstname lastname name email phone company contact_subject message privacy subject].freeze
MAX_REQUEST_BYTES =
20.kilobytes
MAX_FIELD_LENGTH =
5_000

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
21
# File 'app/controllers/journeybook/form_submissions_controller.rb', line 13

def create
  return redirect_to redirect_location, notice: confirmation_text if honeypot_triggered?

  validate_submission!
  FormMailer.new.deliver(fields: form_fields)
  redirect_to redirect_location, notice: confirmation_text
rescue SubmissionError, FormMailer::ConfigurationError, PostmarkClient::Error => error
  redirect_to redirect_location, alert: error.message
end