highway/app/controllers/rsvps_controller.rb
2025-05-07 23:07:54 -04:00

16 lines
415 B
Ruby

class RsvpsController < ApplicationController
def create
@rsvp = Rsvp.find_or_create_by_email!(rsvp_params[:email])
flash[:success] = "Thanks for your interest! We'll be in touch soon."
redirect_to root_path
rescue ActiveRecord::RecordInvalid
flash[:error] = "Please enter a valid email address."
redirect_to root_path
end
private
def rsvp_params
params.permit(:email)
end
end