1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
View (new.html.erb):
<% form_for @contact do |f| %>
  <%= f.text_field "name" %>
  <%= f.text_field "email" %>
  <%= f.submit "Submit" %>
<% end %>

Controller:

    def new
      @contact = Nederlands.new
    end

    def create
      @contact = Nederlands.new(params[:nederlands])
      if @contact.save and request.post?
        Sitemailer.deliver_contact(@contact.naam, @contact.email, @contact.telefoon, @contact.onderwerp, @contact.content)
        first_page = PageCategory.first
        redirect_to dutch_path(first_page.dutch_url)
        redirect_to :action => "new"
        flash[:notice] = "Success"
      else
        render :action => "new"
      end
    end

Routes :

 map.nederlands_index 'nederlands', :controller => "nederlands", :action => "index"
  map.nederlands_gerelateerd 'nederlands/gerelateerd/:id', :controller => 'nederlands', :action => 'gerelateerd'
  map.nederlands_fotoalbum 'nederlands/fotoalbum', :controller => 'nederlands', :action => 'fotoalbum'
  map.nederlands_album 'nederlands/fotoalbum/album/:id', :controller => 'nederlands', :action => 'album'
  map.nederlands_sitemap 'nederlands/sitemap', :controller => 'nederlands', :action => 'sitemap'
  map.nederlands_contact 'nederlands/contact', :controller => 'nederlands', :action => 'new'
  map.nederlands_pagina_niet_gevonden 'nederlands/uw-pagina-niet-gevonden', :controller => 'nederlands', :action => 'PaginaNietGevonden'
  map.resources :nederlands, :member => {:detail => :get, :gerelateerd => :get, :album => :get, :PaginaNietGevonden => :get}