There was a discussion about how this worked earlier today, and I thought I would take the liberty to explain.

Rails respects REST. That is, distinctions are made between GET, POST, HEAD, PUT, and DELETE requests. More Details.

Rails maintains a routing table to keep track of what's what. This is accessible with rake routes. The following output is only partial.

       accounts_login GET    /accounts/login(.:format)        {:controller=>"accounts", :action=>"login"}
     accounts_private GET    /accounts/private(.:format)      {:controller=>"accounts", :action=>"private"}
accounts_authenticate        /accounts/authenticate(.:format) {:controller=>"accounts", :action=>"authenticate"}
      accounts_logout        /accounts/logout(.:format)       {:controller=>"accounts", :action=>"logout"}
         competitions GET    /competitions(.:format)          {:action=>"index", :controller=>"competitions"}
         competitions POST   /competitions(.:format)          {:action=>"create", :controller=>"competitions"}
      new_competition GET    /competitions/new(.:format)      {:action=>"new", :controller=>"competitions"}
     edit_competition GET    /competitions/:id/edit(.:format) {:action=>"edit", :controller=>"competitions"}
          competition GET    /competitions/:id(.:format)      {:action=>"show", :controller=>"competitions"}
          competition PUT    /competitions/:id(.:format)      {:action=>"update", :controller=>"competitions"}
          competition DELETE /competitions/:id(.:format)      {:action=>"destroy", :controller=>"competitions"}
             accounts GET    /accounts(.:format)              {:action=>"index", :controller=>"accounts"}
             accounts POST   /accounts(.:format)              {:action=>"create", :controller=>"accounts"}
          new_account GET    /accounts/new(.:format)          {:action=>"new", :controller=>"accounts"}
         edit_account GET    /accounts/:id/edit(.:format)     {:action=>"edit", :controller=>"accounts"}
              account GET    /accounts/:id(.:format)          {:action=>"show", :controller=>"accounts"}
              account PUT    /accounts/:id(.:format)          {:action=>"update", :controller=>"accounts"}
              account DELETE /accounts/:id(.:format)          {:action=>"destroy ", :controller=>"accounts"}

When Rails sees an HTTP GET request to /accounts/new, it will run the "new" method in the "accounts" controller. If it sees an HTTP POST request to /competitions/, it runs the "create" method in the "competitions" controller and so forth.

This is how the HTML forms get connected up. The form has a submit action of /competitions. I extracted that tidbit from this line:

<form accept-charset="UTF-8" action="/competitions" class="new_competition" id="new_competition" method="post">

When the "Create Competition" button is pressed, the web browser makes an HTTP POST request (as defined in the form's method parameter) to /competitions. Rails looks at that and compares it to its routing table.

Hope that's a reasonable explanation.