Class: Inquiries::InquiriesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

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

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

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

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

#newObject



7
8
9
# File 'app/controllers/inquiries/inquiries_controller.rb', line 7

def new
  @inquiry = Inquiries::Inquiry.new
end

#thank_youObject



4
5
# File 'app/controllers/inquiries/inquiries_controller.rb', line 4

def thank_you
end