Class: ComfyImprint::ContactsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/comfy_imprint/contacts_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /contacts



17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/comfy_imprint/contacts_controller.rb', line 17

def create
  @contact = Contact.new(contact_params)
  if @contact.save
    # Contact Attempt passed validation so it's safe to mail it.
    # In the future I may want to impleme nt some kind of delayed_job or redis hook here
    ContactMailer.contact_email(@contact).deliver
    redirect_to :thank_you #, notice: 'Contact was successfully created.'
  else
    render action: :new
  end
end

#destroyObject

DELETE /contacts/1



30
31
32
33
# File 'app/controllers/comfy_imprint/contacts_controller.rb', line 30

def destroy
  @contact.destroy
  redirect_to contacts_url#, notice: 'Contact was successfully destroyed.'
end

#indexObject



7
8
9
# File 'app/controllers/comfy_imprint/contacts_controller.rb', line 7

def index
  redirect_to root_path
end

#newObject

GET /contacts/new



12
13
14
# File 'app/controllers/comfy_imprint/contacts_controller.rb', line 12

def new
  @contact = Contact.new
end

#thank_youObject



35
36
# File 'app/controllers/comfy_imprint/contacts_controller.rb', line 35

def thank_you
end