# Inserting multiple tuple into the database from single form

**URL:** <https://www.ruby-forum.com/t/inserting-multiple-tuple-into-the-database-from-single-form/113362>\
**Category:** Rails\
**Created:** [August 30, 2007, 11:34am UTC](https://www.ruby-forum.com/t/inserting-multiple-tuple-into-the-database-from-single-form/113362 "2007-08-30T11:34:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vijayendra](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a87d85/32.png) [@vijayendra](https://www.ruby-forum.com/u/vijayendra)\
**Post date:** [August 30, 2007, 11:34am UTC](https://www.ruby-forum.com/t/inserting-multiple-tuple-into-the-database-from-single-form/113362/1 "2007-08-30T11:34:38Z")

</div>

Hi friend

```
 I want to add 5 user names from a single form . but 5 will be

```

inserted into different tuple . how to do that . please help me

---

<div class="post-metadata">

**Author:** ![vijayendra](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a87d85/32.png) [@vijayendra](https://www.ruby-forum.com/u/vijayendra)\
**Post date:** [August 30, 2007, 4:48pm UTC](https://www.ruby-forum.com/t/inserting-multiple-tuple-into-the-database-from-single-form/113362/2 "2007-08-30T16:48:41Z")

</div>

\<% for i in 1…5 %\>  
\<%= render :partial=\>‘user’, :locals =\> { :index =\> i } %\>  
\<% end %\>

in your \_user.rhtml:

\<%= text\_field “user\_#{index}”, ‘field\_name’ %\>  
\<%= text\_field “user\_#{index}”, ‘field\_name\_2’ %\>

in your controller:

for i in 1…5  
user = User.new(params[“user\_#{index}”])  
user.save  
end

when you do the batch edit, it is quite the same way.

On Aug 30, 5:34 am, Vijayendra A. \<rails-mailing-l…@andreas-
