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



20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/comfy_imprint/contacts_controller.rb', line 20

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 @contact#, notice: 'Contact was successfully created.'
  else
    render action: :new
  end
end

#destroyObject

DELETE /contacts/1



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

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



15
16
17
# File 'app/controllers/comfy_imprint/contacts_controller.rb', line 15

def new
  @contact = Contact.new
end

#showObject

GET /contacts/1



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

def show
end