Class: ContactsController

Inherits:
ApplicationController
  • Object
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
17
# File 'app/controllers/contacts_controller.rb', line 7

def create
  @form = Contact.new(params[:contact])

  if @form.valid?
    @form.deliver
    redirect_to contact_path, notice: t('contact.notice.success')
  else
    flash[:warn] = t('contact.notice.error')
    render 'show'
  end
end

#showObject



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

def show
  @form = Contact.new
end