Sha256: 0add6a71578d3cd4934a4c748cd2e0c7bc869f6ca1315722b41dc0f6cf26d4e7

Contents?: true

Size: 979 Bytes

Versions: 1

Compression:

Stored size: 979 Bytes

Contents

require_dependency "phcdevworks_mailer_form/application_controller"

module PhcdevworksMailerForm
    class Website::PagesController < ApplicationController

        # Filters
        before_action :contact_params, only: [:create]

        # Page - Form - Contact
        def contact
            @contact = ContactForm.new
        end

        # Send Contact Email
        def create
            @contact = ContactForm.new(params[:contact_form])
            @contact.request = request
            if @contact.deliver
                flash.now[:notice] = 'Thank You Message Sent!'
                render :index
            else
                flash.now[:error] = 'Error Message Not Sent!'
                render :index
            end
        end

        private

        # Whitelist
        def contact_params
            params.require(:contact_form).permit(:mailer_name, :mailer_email, :mailer_department, :mailer_subject, :mailer_message, :captcha)
        end

    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
phcdevworks_mailer_form-0.0.1b app/controllers/phcdevworks_mailer_form/website/pages_controller.rb