Basic question about partials

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!

Yes. :stuck_out_tongue:

Check out actionpack/lib/action_view/partials.rb and


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs