Never been to DZone Snippets 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

Render partial (See related posts)

<%= render(:partial         => "animal" ,
           :collection      => %w{ ant bee cat dog elk },
           :spacer_template => "spacer" )
%>

animal is the name of template and local variable holding each element of collection inside the partial. animal_counter holds the index of current element in the collection. spacer_template is rendered between each elements in the collection.

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


Click here to browse all 5140 code snippets

Related Posts