Class: InquiriesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/inquiries_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/inquiries_controller.rb', line 13

def create
  @inquiry = Inquiry.new(params[:inquiry])

  if @inquiry.save
    if @inquiry.ham?
      begin
        InquiryMailer.notification(@inquiry, request).deliver
      rescue
        logger.warn "There was an error delivering an inquiry notification.\n#{$!}\n"
      end

      begin
        InquiryMailer.confirmation(@inquiry, request).deliver
      rescue
        logger.warn "There was an error delivering an inquiry confirmation:\n#{$!}\n"
      end
    end

    redirect_to thank_you_inquiries_url
  else
    render :action => 'new'
  end
end

#newObject



9
10
11
# File 'app/controllers/inquiries_controller.rb', line 9

def new
  @inquiry = Inquiry.new
end

#thank_youObject



5
6
7
# File 'app/controllers/inquiries_controller.rb', line 5

def thank_you
  @page = Page.find_by_link_url("/contact/thank_you", :include => [:parts, :slugs])
end