Form_tag routing error in >= 1.2.2?


#1

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!!


#2

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.)
  1. 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 J. removed_email_address@domain.invalid


#3

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)…