Class: ProductEnquiriesController

Inherits:
Spree::BaseController
  • Object
show all
Defined in:
app/controllers/product_enquiries_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/product_enquiries_controller.rb', line 3

def create
  @enquiry = ProductEnquiry.new(params[:product_enquiry])

  respond_to do |format|
    if @enquiry.valid? &&  @enquiry.save
      ProductEnquiryMailer.message_email(@enquiry).deliver
      format.html { redirect_to(:back) }
      flash[:notice] = t('spree_product_enquiries.message_notice')
    else
      format.html { redirect_to(:back) }
      flash[:error] = t('spree_product_enquiries.message_error')
    end
  end
end