What happened to _form.rhtml partial in rails 2.0?

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

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 [email protected] 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.

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

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.

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