I hate the form :partial, :locals thing too... feels dirty.
I like the idea of taking the partial name as the local name... that's
how things like the :collection partial works already.
On 9/25/07, Pratik <[EMAIL PROTECTED]> wrote:
>
> Why not use name of the partial to refer to form object ?
>
> On 9/25/07, Frederick Cheung <[EMAIL PROTECTED]> wrote:
> >
> > I love form_for, but I really hate
> >
> > <% form_for :person, @person, :url => {...} do |f| %>
> > ...
> > <%= render :partial => 'form', :locals => {'f' => f}
> > ...
> > <% end %>
> >
> > I've been thinking of instead allowing
> >
> > <% form_for :person, @person, :url => {...} do |f| %>
> > ...
> > <%= f.partial 'form' %>
> > ...
> > <% end %>
> >
> > f.partial would be exactly the same as the previous snippet, just
> > making the form builder available in the partial without the hassle
> > of :locals => {'f' => f}
> > the one thing I'm not sure about is how you pick the name under which
> > the form builder should appear in the partial.
> >
> > Ideally f.partial 'form' would give you something sensible, but I'm
> > not sure how you would pick such a default
> >
> > f.partial 'form', :name => 'f' would work, but then it's almost as
> > awkward as :locals => {'f' => f}
> >
> > Any ideas (or is this one just stupid ?) ?
> >
> > Fred
> >
> > >
> >
>
>
> --
> Cheers!
> - Pratik
> http://m.onkey.org
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---