kesslerdn wrote:> How can I easily display an array of model objects in a form using rhtml?
> For example I have a Document model that has one-to-many sections. The
> user can add as many sections as they like. The user needs to be able to
> have full CRUD capabilities for each of these sections within the
> application. In a jsp/struts world this is quite easy with an iterator
> tag. This approach is simple and scalable. Is there a similar mechanism
> for Rails?
Array#each is usually what you want, unless I''ve misread your question.
Something like:
<%= link_to ''New section'',
:action=>''create_section'', :id=>document %>
<% document.sections.each do |sect| %>
<%= render_sect_row sect %>
<% end %>
would do the trick, providing your variables and methods are in place.
--
Alex