Forum: Ruby on Rails form_tag routing error in >= 1.2.2 ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5e75f4b81923cd04a5c8fffa290be92e?d=identicon&s=25 Carl Johnson (carlivar)
on 2007-06-28 06:22
I have a simple feedback form handled by feedback_controller. For
methods I use "new" for the form and "create" to handle the feedback
submitted.

Routes are simple enough:

map.resources :feedback

What's odd is this works fine in Rails 1.2.1:

<% form_tag(feedback_path) do -%>

But in Rails 1.2.2 and 1.2.3 I get:

feedback_url failed to generate from {:action=>"show",
:controller=>"feedback"} - you may have ambiguous routes, or you may
need to supply additional parameters for this route.  content_url has
the following required parameters: ["feedback", :id] - are they all
satisifed?

Any idea why?

Thanks!!
D7c511ce5025d37b8c6bd9134e0f2bd9?d=identicon&s=25 Thorsten (Guest)
on 2007-06-28 11:42
(Received via mailing list)
in resource routes, you normally have a pluralized model name:

map.resource :feedbacks

the you get:
1) feedbacks_path
# => GET/POST /feedbacks/
      (for getting a list of items or creating a new one.)
2) feedback_path(@feedback)
#=> GET/PUT/DELETE /feedbacks/ID_OF_GIVEN_FEEDBACK
      (for getting/updateing/deleting a specific record with a given
ID)
see the difference?
feedback_path <-> feedbackS_path

try this
<%= form_tag(feedbacks_path) %>

But also i think as your resource name is not pluralized something
gets mixed up somewhere along the way of these routing helpers, and
the error could still be there.
That it worked in 1.2.1 and not in 1.2.3 may be due to some code
changes in this area ....
try pluralizing your resource name in routes.rb too.


On 28 Jun., 06:22, Carl Johnson <rails-mailing-l...@andreas-s.net>
5e75f4b81923cd04a5c8fffa290be92e?d=identicon&s=25 Carl Johnson (carlivar)
on 2007-06-28 20:37
Thorsten wrote:
> in resource routes, you normally have a pluralized model name:
>
> map.resource :feedbacks
>
> the you get:
> 1) feedbacks_path
> # => GET/POST /feedbacks/
>       (for getting a list of items or creating a new one.)

Ah OK. Yeah, I was trying to make my English too proper! I changed the
naming to "feedbacks" in all the relevant places and it is working now.

Now I just need to figure out how to make the URL a little prettier
(/feedback/new instead of /feedbacks/new)...
This topic is locked and can not be replied to.