Class: Contactus::ContactFormsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/contactus/contact_forms_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/contactus/contact_forms_controller.rb', line 9

def create
  begin
    @contact_form = ContactForm.new(params[:contactus_contact_form])
    @contact_form.request = request

    if !@contact_form.deliver
      if @contact_form.spam?
        flash[:error] = I18n.t('.contactus.contact_forms.spam')
        redirect_to root_path
      else
        render :new
      end
    end

  rescue ScriptError
    flash[:error] = I18n.t('.contactus.contact_forms.spam')
    redirect_to root_path
  end
end

#newObject



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

def new 
  @contact_form = ContactForm.new
end