Class: ContactController

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

Overview

This controller provides the basic contact form.

Instance Method Summary collapse

Methods inherited from BarkestCore::ApplicationControllerBase

#authorize!, #show_denial_reason?

Methods included from BarkestCore::StatusHelper

#clear_system_status, #show_system_status, #status_button_label, #status_redirect_url

Methods included from BarkestCore::RecaptchaHelper

#add_recaptcha_challenge, #verify_recaptcha_challenge

Methods included from BarkestCore::SessionsHelper

#current_user, #current_user?, #forget, #log_in, #log_out, #logged_in?, #redirect_back_or, #remember, #store_location, #store_location_and_redirect_to, #system_admin?

Instance Method Details

#createObject

POST /contact



14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/contact_controller.rb', line 14

def create
  @msg = get_message
  if @msg.valid? && verify_recaptcha_challenge(@msg)
    @msg.remote_ip = request.remote_ip
    @msg.send_message
    flash[:success] = 'Your message has been sent.'
    redirect_to root_url
  else
    render 'index'
  end
end

#indexObject

GET /contact



8
9
10
# File 'app/controllers/contact_controller.rb', line 8

def index
  @msg = BarkestCore::ContactMessage.new
end