Update contact form so it confirms the message was sent

This commit is contained in:
rebuilt 2022-11-01 17:06:01 -07:00
parent 7f433cf223
commit f8c91add3e
7 changed files with 25 additions and 10 deletions

View file

@ -1,5 +1,20 @@
class HomeController < ApplicationController
skip_before_action :verify_authenticity_token
def index
@contact = Contact.new
end
def create
puts '***************************** Inside home controller *****************************************'
flash.now[:success] = 'Message sent!'
@contact = Contact.new(params[:contact])
@contact.request = request
if @contact.deliver
flash.now[:success] = 'Message sent!'
else
flash.now[:error] = 'Could not send message'
end
render :index
end
end