RESTful form_for generation

In my view I wrote the following :

<% form_for [@academy, @ecourse ], :url => { :action =>
"update" }, :html => {:method => :put} do |f| %>

but it's generating the html code :

<form action="/ecourses/4" class="edit_ecourse" id="edit_ecourse_4"
method="post">
<div style="margin:0;padding:0"><input name="_method" type="hidden"
value="put" />
.....

rather than action : /academies/1/ecourses/4.. and the method is
still 'post'

I am sure to be wrong but where ?

thanks fyh

erwin

Try the following steps:

1. Remove :url => { :action => "update" }, you do not need this as the
[@academy, @ecourse ] will generate the correct path and the :html =>
{:method => :put} will generate the correct method for submission

2. Check that @academy is not nil, but off the top of my head I think
it would generate an incorrect path and would raise an error

3. The method has been generated correctly. See: <input name="_method"
type="hidden" value="put" /> This is a Rails hack as browsers do not
support the 'put' method natively. That's why you still see 'post' in
the actual form tag.

HTH,
Nicholas