19 May 13:21
Re: Cleanest syntax for form partial?
From: Ryan Bigg (Radar <radarlistener@...>
Subject: Re: Cleanest syntax for form partial?
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-05-19 11:21:13 GMT
Subject: Re: Cleanest syntax for form partial?
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-05-19 11:21:13 GMT
Bugger!
I had a niggling thought at the back of my mind as I wrote that post that it was the case, but chose to ignore it.
Oh well, render :partial => "form", :f => f looks like the cleanest way for now, unless you don't mind not being Ruby 1.9 compatible, but it will come to bite you in the ass later on.
On Mon, May 19, 2008 at 8:45 PM, Rick DeNatale <rick.denatale-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Cleanliness is in the eye of the beholder.
On Sun, May 18, 2008 at 10:05 PM, Ryan Bigg (Radar)
<radarlistener-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> <% form_for ... do | <at> f| %>
> <%= render :partial => "form" %>
> <% end %>
>
> Even cleaner! Passing in your form object as an instance variable gives you
> the added bonus of having it available in any partial you render after
> defining it.
In any case, beware that Ruby 1.9 disallows using instance variables
as block parameters, so if you're forward thinking this might be a
technique to avoid.
--
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/
--
Appreciated my help?
Reccommend me on Working With Rails
http://workingwithrails.com/person/11030-ryan-bigg
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
RSS Feed