Class: Refinery::Inquiries::InquiriesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

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

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

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

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

#newObject



11
12
13
# File 'app/controllers/refinery/inquiries/inquiries_controller.rb', line 11

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

#thank_youObject



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

def thank_you
  @page = ::Refinery::Page.find_by_link_url("/contact/thank_you")
end