Class: Integral::Enquiry

Inherits:
ApplicationRecord show all
Defined in:
app/models/integral/enquiry.rb

Overview

Represents a contact enquiry made by visitors

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

available_statuses

Instance Attribute Details

#first_nameObject

NOTE: first_name acts as honey pot



6
7
8
# File 'app/models/integral/enquiry.rb', line 6

def first_name
  @first_name
end

Instance Method Details

#processObject

Forward the enquiry on and send an auto reply. Create newsletter signup if necessary



19
20
21
22
23
# File 'app/models/integral/enquiry.rb', line 19

def process
  ContactMailer.forward_enquiry(self).deliver_later
  ContactMailer.auto_reply(self).deliver_later
  NewsletterSignup.create(name: name, email: email, context: context) if newsletter_opt_in?
end

#referenceObject

Reference used to uniquely identify the enquiry



26
27
28
29
# File 'app/models/integral/enquiry.rb', line 26

def reference
  num = 3008 + id
  "##{num}"
end