Sha256: a49eddc5e53fde2a9ee818d96d0d6e85e9d391a304190a2aed20f66c350e889d

Contents?: true

Size: 699 Bytes

Versions: 46

Compression:

Stored size: 699 Bytes

Contents

module Incline
  class ContactController < ApplicationController

    allow_anon true

    ##
    # GET /incline/contact
    def new
      @msg = Incline::ContactMessage.new
    end

    ##
    # POST /incline/contact
    def create
      @msg = get_message
      if @msg.valid?
        @msg.remote_ip = request.remote_ip
        @msg.send_message
        flash[:success] = 'Your message has been sent.'
        redirect_to main_app.root_url
      else
        render 'new'
      end
    end

    private

    def get_message
      p = params.require(:contact_message).permit(:your_name, :your_email, :related_to, :subject, :body, :recaptcha)
      Incline::ContactMessage.new(p)
    end

  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
incline-0.2.6 app/controllers/incline/contact_controller.rb
incline-0.2.5 app/controllers/incline/contact_controller.rb
incline-0.2.4 app/controllers/incline/contact_controller.rb
incline-0.2.3 app/controllers/incline/contact_controller.rb
incline-0.1.9 app/controllers/incline/contact_controller.rb
incline-0.1.8 app/controllers/incline/contact_controller.rb