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