2
0
mirror of https://github.com/sharkdp/bat synced 2024-11-08 19:10:41 +00:00
bat/tests/syntax-tests/highlighted/Ruby On Rails/test.rb
2020-11-23 15:43:58 +01:00

23 lines
3.0 KiB
Ruby
Vendored
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class ContactsController < ApplicationController
 def new
 @contact = Contact.new
 end
 def create
 @contact = Contact.new(secure_params)
 if @contact.valid?
 UserMailer.contact_email(@contact).deliver_now
 flash[:notice] = "Message sent from #{@contact.name}."
 redirect_to root_path
 else
 render :new
 end
 end
 private
 def secure_params
 params.require(:contact).permit(:name, :email, :content)
 end
end