I''m just wondering if you can use yield/closures in action view
templates, it''s kind of hard to explain so I''ll use an
example:
<%= render(:partial => "table_builder", :locals => {:headings
=>
["name", "id"], :collection => @users}) do |user| %>
#the partial build a table with the headings etc and then yields
here for the row data
<td><%= user.name %></td><td><%=user.id
%></td>
<% end %>
That abstracts all the table building etc into a partial and leaves
the view specific stuff to the view, without needing another partial.
Is this possible with rails? I know it is in monorail but I haven''t
seen it done with rails so any pointers would be appreciated.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---