Sha256: 97d40f87df2b48ede86e4af31b9c3ac714537e6049e4e62fe4904058d436f4f2

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

class InquiriesController < ApplicationController

  before_filter :find_page, :only => [:create, :new]

  def thank_you
    @page = Page.find_by_menu_match("^/inquiries/thank_you$", :include => [:parts, :slugs])
    
    respond_to do |wants|
      wants.html
    end
  end

  def new
    @inquiry = Inquiry.new
    
    respond_to do |wants|
      wants.html
    end
  end

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

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

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

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

protected

  def find_page
    @page = Page.find_by_link_url('/inquiries/new', :include => [:parts, :slugs])
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
refinerycms-0.9.5.13 vendor/plugins/inquiries/app/controllers/inquiries_controller.rb
refinerycms-0.9.5.12 vendor/plugins/inquiries/app/controllers/inquiries_controller.rb
refinerycms-0.9.5.11 vendor/plugins/inquiries/app/controllers/inquiries_controller.rb
refinerycms-0.9.5.10 vendor/plugins/inquiries/app/controllers/inquiries_controller.rb
refinerycms-0.9.5.9 vendor/plugins/inquiries/app/controllers/inquiries_controller.rb
refinerycms-0.9.5.8 vendor/plugins/inquiries/app/controllers/inquiries_controller.rb