Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Substitute for the :spacer_template option to rail's "render" method (See related posts)

when working with the :collection option, it seems silly to have to have an entire file just for a spacer, which would probably just be something like "
" for most, so this is a great substitute for
<%= render :partial => "thing", :collection => @coll, :spacer_template => "filename_to_file_with_hr_inside_it" %>


New version with code embedded:
  <%= @coll.map { |item| render :partial => "thing", :locals => {:thing => item} }.join("
") %>

Comments on this post

fucema posts on Jul 14, 2006 at 22:48
Thanks for the nice ruby snippet, Jenna.

How can this be modified to also pass the counter value (ie. :thing_counter)?

You need to create an account or log in to post comments to this site.


Related Posts