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

About this user

DeLynn Berry http://www.delynnberry.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Creating a Multiple Row Form

// Jamis Buck's reply to a mailing list question: http://www.ruby-forum.com/topic/52514#26231

The View
   1  
   2  <% 10.times do |n| %>
   3    <%= text_field_tag "milestones[#{n}][title]" %><br />
   4  <% end %>

The Controller
   1  
   2  def create
   3    10.times do |n|
   4      next if params[:milestones][n.to_s][:title].blank?
   5      Milestone.create(params[:milestones][n.to_s])
   6    end
   7  end
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS