# Importing data

**URL:** <https://www.ruby-forum.com/t/importing-data/94503>\
**Category:** Rails\
**Created:** [November 12, 2005, 12:50pm UTC](https://www.ruby-forum.com/t/importing-data/94503 "2005-11-12T12:50:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![snacktime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@snacktime](https://www.ruby-forum.com/u/snacktime)\
**Post date:** [November 12, 2005, 12:50pm UTC](https://www.ruby-forum.com/t/importing-data/94503/1 "2005-11-12T12:50:12Z")

</div>

I have an application that needs to have some tables initially  
populated,  
such as users, roles, and basic configuration data. The best thing I can  
think of is to just use put together a script that uses activerecord to  
load  
the data. Is there a better way?

Chris

---

<div class="post-metadata">

**Author:** ![snacktime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@snacktime](https://www.ruby-forum.com/u/snacktime)\
**Post date:** [November 12, 2005, 12:50pm UTC](https://www.ruby-forum.com/t/importing-data/94503/2 "2005-11-12T12:50:12Z")

</div>

Hi !

2005/11/11, snacktime [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I have an application that needs to have some tables initially populated,  
> such as users, roles, and basic configuration data. The best thing I can  
> think of is to just use put together a script that uses activerecord to load  
> the data. Is there a better way?

Migrations ? With migrations, you can do anything, including using  
ActiveRecord instances to populate data. I often do that myself, as  
well as use it to clean up records.

Hope that helps !  
FranÃ§ois

---

<div class="post-metadata">

**Author:** ![snacktime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@snacktime](https://www.ruby-forum.com/u/snacktime)\
**Post date:** [November 12, 2005, 9:34pm UTC](https://www.ruby-forum.com/t/importing-data/94503/3 "2005-11-12T21:34:47Z")

</div>

On 11/11/05, Francois B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Migrations ? With migrations, you can do anything, including using  
> ActiveRecord instances to populate data. I often do that myself, as  
> well as use it to clean up records.
> 
> Hope that helps !  
> FranÃ§ois

Yes migrations looks like a good place to add initial data and anything  
else  
that might need to be added for upgrades. Thanks for the pointer.

Chris
