I'm new to Rails and working through the Agile Web Dev w\Rails book (which is great by the way). My question is: Do partials iterate by default? For example, in Chapter 10 of the before mentioned book, the author introduces partials and basically codes an HTML table row populated with ruby objects. This code (partial) then goes into the HTML table but nowhere in the code (partial or view) do I see any iteration code. Like I say, I'm new and I'm trying to figure out how the 'magic' happens. How does rails take one HTML row and repeat it throughout a table? Does rails iterate through the ':collection' repeating rows as long as there is data in the ':collection'? Thanks for any help in advance!
on 2005-12-11 02:48
on 2005-12-11 03:08
Yes. :P Check out actionpack/lib/action_view/partials.rb and render_partial_collection method. Kent.