# inserting multiple tuple into the database from single form

**URL:** <https://discuss.rubyonrails.org/t/inserting-multiple-tuple-into-the-database-from-single-form/17579>\
**Category:** rubyonrails-talk\
**Created:** [August 30, 2007, 2:47pm UTC](https://discuss.rubyonrails.org/t/inserting-multiple-tuple-into-the-database-from-single-form/17579 "2007-08-30T14:47:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jack\_Zhan](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@Jack\_Zhan](https://discuss.rubyonrails.org/u/Jack_Zhan)\
**Post date:** [August 30, 2007, 2:47pm UTC](https://discuss.rubyonrails.org/t/inserting-multiple-tuple-into-the-database-from-single-form/17579/1 "2007-08-30T14:47:45Z")

</div>

\<% for i in 1..5 %\> &nbsp;&nbsp;\<%= 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 &nbsp;&nbsp;user = User.new(params["user\_#{index}"]) &nbsp;&nbsp;user.save end

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