# What happened to \_form.rhtml partial in rails 2.0?

**URL:** <https://www.ruby-forum.com/t/what-happened-to-form-rhtml-partial-in-rails-2-0/125411>\
**Category:** Rails\
**Created:** [January 8, 2008, 10:31pm UTC](https://www.ruby-forum.com/t/what-happened-to-form-rhtml-partial-in-rails-2-0/125411 "2008-01-08T22:31:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![resident\_moron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/5daacb/32.png) [@resident\_moron](https://www.ruby-forum.com/u/resident_moron)\
**Post date:** [January 8, 2008, 10:31pm UTC](https://www.ruby-forum.com/t/what-happened-to-form-rhtml-partial-in-rails-2-0/125411/1 "2008-01-08T22:31:30Z")

</div>

Just wondering if anyone could point me to a good explanation of why  
the latest way of doing things does not include using something like  
\_form.html.erb partials in RESTful rails 2.0?? Why did we move away  
from partials, etc??

---

<div class="post-metadata">

**Author:** ![resident\_moron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/5daacb/32.png) [@resident\_moron](https://www.ruby-forum.com/u/resident_moron)\
**Post date:** [January 8, 2008, 11:48pm UTC](https://www.ruby-forum.com/t/what-happened-to-form-rhtml-partial-in-rails-2-0/125411/2 "2008-01-08T23:48:17Z")

</div>

If you gave us more information as to what your problem was, then maybe  
we  
can help. Ranting & Raving about it doesn’t help us.

Rails 2.0 is using partials the exact same way all previous versions  
have  
been.

On Jan 9, 2008 8:01 AM, rails.impaired [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Just wondering if anyone could point me to a good explanation of why  
> the latest way of doing things does not include using something like  
> \_form.html.erb partials in RESTful rails 2.0?? Why did we move away  
> from partials, etc??
> 
> >

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

Feel free to add me to MSN and/or GTalk as this email.

---

<div class="post-metadata">

**Author:** ![resident\_moron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/5daacb/32.png) [@resident\_moron](https://www.ruby-forum.com/u/resident_moron)\
**Post date:** [January 9, 2008, 11:58am UTC](https://www.ruby-forum.com/t/what-happened-to-form-rhtml-partial-in-rails-2-0/125411/3 "2008-01-09T11:58:06Z")

</div>

I guess what you mean is why is the \_form.html.erb not separated from  
the new.html.erb and edit.html.erb views any more when you generate a  
scaffold.

Partials are still there and very much in favour where appropriate. In  
the context of the scaffold, I think they have moved away from using  
them for 2 reasons:

1. The use of partials for the inner section of the form prevent us  
using the block level variable (usually f) to indicate the model  
association of the form\_for  
(e.g.  
form\_for(:post, posts\_url do |f|  
f.text\_area(:title)  
end  
)

2. Often the edit form is different to the new form. This allows us to  
be ready to make these changes when they occur

Other than those reasons i can’t think of any other good ones for  
making the change, but especially (1) seems to be the most likely  
reason.

Nothing to stop you doing it for your views, either pass the “f”  
variable through in the :locals =\> {} hash of the partial, or use the  
fields\_for method within the partial.

---

<div class="post-metadata">

**Author:** ![resident\_moron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/5daacb/32.png) [@resident\_moron](https://www.ruby-forum.com/u/resident_moron)\
**Post date:** [January 9, 2008, 12:11pm UTC](https://www.ruby-forum.com/t/what-happened-to-form-rhtml-partial-in-rails-2-0/125411/4 "2008-01-09T12:11:37Z")

</div>

On Jan 9, 2008, at 11:57 AM, Wildtangent wrote:

> Nothing to stop you doing it for your views, either pass the “f”  
> variable through in the :locals =\> {} hash of the partial, or use the  
> fields\_for method within the partial.

Another option is to move the entire form into the partial using the  
new idiom form\_for(@model).

It was customary to leave it outside to be able to write different  
actions by hand in the new/edit templates, but this new idiom DRYfies  
that.

– fxn
