Single Text_Area for multiple records

I have an application I've developed where there is a record of data which is entered line by line, I've got that working fine. The form now only has one field, because that's all the data which is required. I would like to make it simpler by providing a text_area, and the user would enter a list of values and on submit have the controller or the model parse the data into records and append them into the table. I've looked for examples of the correct 'Rails way' of doing this type of process, but everything looks like a single record posted. Does anyone know of a Gem or module which will make this simpler?

Thanks!

Perhaps, and this is just some "brain dump" at the moment, you could set up a separate attribute and then use some Ruby to take that imput and split it so that you can save it as separate attributes. I have no idea how you would do this code wise, but having a text field set up as :input and then attr_accesssor :input and then work from there with some Ruby to split at newlines or with some other kind of operator.

That's a great Idea, It's the How I'm trying to figure out. This is a simple task in PHP or ASP, but Ruby is a different animal completely, and I don't want to buck the system. Thanks for your input.

Hey smfrick,

I just encountered this same problem, here's a rather hacked together solution, maybe some people here can help optimize it:

def create   #GRAB FORM DATA   @temp_array = params[:form_name]   #GET ARRAY MADE OF EACH LINE OF TEXT_AREA   @temp_array = @temp_array["text_area"].split(/[\r\n]/)   #VARIABLE TO ENSURE AT LEAST ONE RECORD WAS SAVED   @success = 0   #LOOP   @temp_array.each do |temp_individual_record|     if temp_individual_record.length()>0 #ENSURE NO BLANKS       @model = ModelName.new(params[:form_name]) #GRAB ANY OTHER FIELDS       @model.text_area=temp_individual_record #OVERWRITE TEXTAREA       @model.save       @success=1     end   end     respond_to do |format|       if @success==1         flash[:notice] = 'Model was successfully created.'         format.html { redirect_to(@model) }         format.xml { render :xml => @model, :status => :created, :location => @model }       else         format.html { render :action => "new" }         format.xml { render :xml => @model.errors, :status => :unprocessable_entity }       end     end   end