Class: ContactFormPortlet

Inherits:
Portlet
  • Object
show all
Defined in:
app/portlets/contact_form_portlet.rb

Instance Method Summary collapse

Instance Method Details

#renderObject



6
7
8
9
# File 'app/portlets/contact_form_portlet.rb', line 6

def render
  @contact = Contact.new
  @contact.errors.add_from_hash flash["#{instance_name}_errors"]
end

#submitObject



11
12
13
14
15
16
17
18
19
20
21
# File 'app/portlets/contact_form_portlet.rb', line 11

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

  if @contact.save
    url_for_success
  else
    store_params_in_flash
    store_errors_in_flash(@contact.errors)
    url_for_failure
  end
end