Multiple Values in Form Field and Creating Multiple Records

Hi David,

David Lelong wrote:

I want to be able to have users enter one or more email addresses in a field and have a database row created for each of those email addresses.

Here is an example of my form output:


how do I iterate over the email addresses?

Assuming your email address table was named something like 'addresses' you could do something like...

params[:email_address].each(',') {|this_address|
   address_to_add =
   address_to_add.created_on = params[:created_on]
   address_to_add.job_id = params[:job_id]
   address_to_add.user_id = params[:user_id]
   address_to_add.email_address = this_address