# Insert Multiple records in table

**URL:** <https://www.ruby-forum.com/t/insert-multiple-records-in-table/178294>\
**Category:** Rails\
**Created:** [November 2, 2009, 11:34am UTC](https://www.ruby-forum.com/t/insert-multiple-records-in-table/178294 "2009-11-02T11:34:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brijesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@brijesh](https://www.ruby-forum.com/u/brijesh)\
**Post date:** [November 2, 2009, 11:34am UTC](https://www.ruby-forum.com/t/insert-multiple-records-in-table/178294/1 "2009-11-02T11:34:35Z")

</div>

Hi

Here I want to insert multiple records into a single table.  
Table is users.: email, password, password\_confirmation and country…  
“Add one more” functionality is also there so multiple records can be  
vary…

There are two problems for me.

1, How to create/insert the records :(might be using array text  
fields…)

1. If there is not valid record then how can I restore the value in the  
text field.

So can anyone help me ?

Thanks  
Brijesh S.

---

<div class="post-metadata">

**Author:** ![brijesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@brijesh](https://www.ruby-forum.com/u/brijesh)\
**Post date:** [November 2, 2009, 11:53am UTC](https://www.ruby-forum.com/t/insert-multiple-records-in-table/178294/2 "2009-11-02T11:53:40Z")

</div>

[http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes](http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes)

On Mon, Nov 2, 2009 at 4:04 PM, Brijesh S. \<  
removed\_email\_address@domain.invalid\> wrote:

> 1, How to create/insert the records :(might be using array text  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

## – [http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes](http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes) Sandip

> **[Fun On Rails](http://funonrails.com/)**
>
> Journal of a Web Developer #ruby #rails #JS

---

<div class="post-metadata">

**Author:** ![brijesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@brijesh](https://www.ruby-forum.com/u/brijesh)\
**Post date:** [November 2, 2009, 12:01pm UTC](https://www.ruby-forum.com/t/insert-multiple-records-in-table/178294/3 "2009-11-02T12:01:18Z")

</div>

Sandip R. wrote:

> [http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes](http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes)
> 
> On Mon, Nov 2, 2009 at 4:04 PM, Brijesh S. \<  
> removed\_email\_address@domain.invalid\> wrote:
> 
> > 1, How to create/insert the records :(might be using array text  
> > Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> > 
> > >
> 
> ## – [http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes](http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes) Sandip
> 
> [www.funonrails.com](http://www.funonrails.com)

Thanks , but this link is not my solution

This link will help me to insert multiple records in different (nested  
table)  
where I want to insert multiple records in same table with  
validations…

Thanks  
Brijesh S.

---

<div class="post-metadata">

**Author:** ![brijesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@brijesh](https://www.ruby-forum.com/u/brijesh)\
**Post date:** [November 2, 2009, 1:27pm UTC](https://www.ruby-forum.com/t/insert-multiple-records-in-table/178294/4 "2009-11-02T13:27:55Z")

</div>

Check out ar-extensions ([http://www.continuousthinking.com/tags/](http://www.continuousthinking.com/tags/)  
arext). Here’s an article that explains the usage:  
[http://www.jobwd.com/article/show/31](http://www.jobwd.com/article/show/31).

Specifically, you’ll probably want to look at the import method it  
provides. You can tell it whether or not you want to use validations  
as well.

Jon

On Nov 2, 5:01 am, Brijesh S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
