views:

76

answers:

2

I seem to have a problem that I can't find the solution for myself, I hope someone can help.

I have a form defined like so:

<% form_for @leads do |f| %>

I have a resource called @leads (map.resource :leads)

But when I look in the HTML code of the page it generates, I see as a form action the following

<form action="/lead.%23%3Clead:0x10333e858%3E" class="edit_lead" ... etc

The lead.%23%3Clead:0x10333e858%3E as a form action does work, however rails doesn't know what to do with it after it updates. Does anyone know how I can make this a normal URL so that rails can redirect after the update again?

Thank you very much Regards, Marco

+1  A: 

I think you have to rename your route from

 map.resource :leads

to

map.resources :leads

because you have multiple leads (and not only one -> so no "resource", its "resources")

Lichtamberg
A: 

If you are using a singular resource you should not pass the object to the url helper, ie. lead_path not lead_path(@lead).

However it does look like a typo and your route should be map.resources :leads

MatthewFord