Last active
August 29, 2015 14:04
-
-
Save MikeRogers0/99e9e476be81a2b554be to your computer and use it in GitHub Desktop.
An example of a terrible approach to a contact form.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ContactUsController < ApplicationController | |
def index | |
end | |
def send_enquiry | |
if contact_form_valid? | |
ContactUsMailer.send_enquiry(contact_form_params).deliver | |
return redirect_to action: :thank_you | |
end | |
render :index | |
end | |
def thank_you | |
end | |
private | |
def contact_form_valid? | |
contact_form_params[:name].present? && contact_form_params[:email].present? && contact_form_params[:email].present? | |
end | |
def contact_form_params | |
params.require(:contact_form).permit! | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment