# RESTful form\_for generation

**URL:** <https://www.ruby-forum.com/t/restful-form-for-generation/170310>\
**Category:** Rails\
**Created:** [June 15, 2009, 7:46pm UTC](https://www.ruby-forum.com/t/restful-form-for-generation/170310 "2009-06-15T19:46:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [June 15, 2009, 7:46pm UTC](https://www.ruby-forum.com/t/restful-form-for-generation/170310/1 "2009-06-15T19:46:46Z")

</div>

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 :

.....

rather than action : /academies/1/ecourses/4… and the method is  
still ‘post’

I am sure to be wrong but where ?

thanks fyh

erwin

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [June 16, 2009, 5:18pm UTC](https://www.ruby-forum.com/t/restful-form-for-generation/170310/2 "2009-06-16T17:18:32Z")

</div>

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