1
0
mirror of https://github.com/danbee/danbarberphoto synced 2025-03-04 08:49:07 +00:00
danbarberphoto/app/controllers/contacts_controller.rb

23 lines
479 B
Ruby

class ContactsController < ApplicationController
def new
@contact = Contact.new(:id => 1)
@page_title = 'Contact'
end
def create
@contact = Contact.new(permitted_params)
if @contact.save
redirect_to(:new_contact, :notice => t("contact.thanks"))
else
flash[:alert] = t("contact.invalid")
render :new
end
end
private
def permitted_params
params.require(:contact).permit(:id, :email, :subject, :name, :message)
end
end