Calling Create action from a link_to

I have a Collection resource set up and I have configured my routes
map.resources :collections

I want to have a link which will create a new collection (instead of
adding one via the form in the New action). I was under the impression
that I could just do a POST call to the collections_path. e.g:
<%= link_to "New Collection", collections_path, :method => :post %>

However, when I do this, I am routed to the Index action. The logs
Processing CollectionsController#index (for at 2008-09-26
14:20:22) [POST]
  Session ID: 0b5dd35a6f2133dc7a9840e2d786c822
  Parameters: {"action"=>"index",

What am I doing wrong? Why is the POST to the collections path routing
me to the index action? How do I make a link to the create action?


The parameter :method should be put on the html options hash instead
of the url hash. Try this:

<%= link_to "New Collection", {}, :method => :post %>

That is strange. It should route to the create action.

Any chance you have a route higher up in your routes.rb that's taking

Also what version of Rails? (perhaps you made a change to your
routes.rb and need to restart your local server?)


REST with Rails: Oct 4, 2008 in Austin TX:
Use discount code "PWRRGG"

Apologies, i must not have restarted the server after changing some
routes. I've restarted and its behaving as expected now.
Thanks for the help