Class: ContactsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/contacts_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/contacts_controller.rb', line 7

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

#newObject



3
4
5
# File 'app/controllers/contacts_controller.rb', line 3

def new
  @contact = Contact.new
end