On Sep 26, 9:21 pm, Tim Conner <[EMAIL PROTECTED]>
wrote:
> Hi,
> I have a Collection resource set up and I have configured my routes
> file:
> 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
> show:
> Processing CollectionsController#index (for 127.0.0.1 at 2008-09-26
> 14:20:22) [POST]
>   Session ID: 0b5dd35a6f2133dc7a9840e2d786c822
>   Parameters: {"action"=>"index",
> "authenticity_token"=>"cb5d37816a3a4f0bdc14701b8a5127f1c3dc99c6",
> "controller"=>"collections"}
>
> 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?
>
> Thanks
> --
> Posted viahttp://www.ruby-forum.com/.

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

<%= link_to "New Collection", {}, :method => :post %>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to