require_dependency "phcdevworks_mailer_form/application_controller" module PhcdevworksMailerForm class Website::PagesController < ApplicationController # Page - Form - Contact def contact @contact = FormMailers.new end # Send Contact Email def create @contact = FormMailers.new(params[:contact_form]) @contact.request = request if @contact.deliver format.html { redirect_to contact_us_path, :flash => { :success => 'Nessage has been Sent.' }} else flash.now[:error] = 'Error Message Not Sent!' render :contact end end private # Whitelist def contact_params params.require(:contact_form).permit(:mailer_name, :mailer_email, :mailer_department, :mailer_subject, :mailer_message, :mailer_captcha) end end end