I'm not sure what I'm doing wrong. I have a Projects resource:
resources :projects
In ProjectsController#new, I'm creating a project and rendering it in new.html.erb:
<%= form_for @project do |f| %>
<%= f.label :name %>
<%= f.text_field :name%><br/>
<%= f.submit %>
<% end %>
This gets POSTed but instead of being handled by Projects#create it's being handled by the home action:
Started POST "/projects" for 127.0.0.1 at 2012-11-02 08:47:36 -0500
Processing by ProjectsController#home as HTML
Here are my routes:
/ projects#home
projects /projects(.:format) projects#home
GET /projects(.:format) projects#index
POST /projects(.:format) projects#create
new_project GET /projects/new(.:format) projects#new
edit_project GET /projects/:id/edit(.:format) projects#edit
project GET /projects/:id(.:format) projects#show
PUT /projects/:id(.:format) projects#update
DELETE /projects/:id(.:format) projects#destroy
EDITED: I found the problem.
This is the old routes file:
SolarMesh::Application.routes.draw do
match '/' => 'projects#home'
match '/projects' => 'projects#home'
resources :projects
end
The line "match '/projects'" was the reason it was always being handled by home.