# Database seeding

**URL:** <https://www.ruby-forum.com/t/database-seeding/66985>\
**Category:** Rails\
**Created:** [August 30, 2006, 7:49pm UTC](https://www.ruby-forum.com/t/database-seeding/66985 "2006-08-30T19:49:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 30, 2006, 7:49pm UTC](https://www.ruby-forum.com/t/database-seeding/66985/1 "2006-08-30T19:49:51Z")

</div>

Hi All,

How are people typically seeding a database when doing a new install?

I would assume doing this with a Rake task but it could also be done  
with migrations. Fixtures could also do this be used to do this?

Thoughts comments?

Thanks,  
Serge

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 30, 2006, 8:11pm UTC](https://www.ruby-forum.com/t/database-seeding/66985/2 "2006-08-30T20:11:55Z")

</div>

On 8/30/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How are people typically seeding a database when doing a new install?
> 
> I would assume doing this with a Rake task but it could also be done  
> with migrations. Fixtures could also do this be used to do this?

I’m using fixtures and `rake db:fixtures:load`.

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 30, 2006, 8:23pm UTC](https://www.ruby-forum.com/t/database-seeding/66985/3 "2006-08-30T20:23:56Z")

</div>

Hi Serge –

On 30-Aug-06, at 1:40 PM, removed\_email\_address@domain.invalid wrote:

> I would assume doing this with a Rake task but it could also be done  
> with migrations. Fixtures could also do this be used to do this?

I prefer to use fixtures over migrations for this. So, you create  
your fixtures with all your seed data, and then load them with:

rake db:fixtures:load

This approach is cool because it serves a dual purpose: it gives you  
a place to put your seed data, and gives you realistic test data for  
testing.

/Jeff

–  
[http://re.visioni.st](http://re.visioni.st)  
[http://quotedprintable.com](http://quotedprintable.com)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 30, 2006, 11:46pm UTC](https://www.ruby-forum.com/t/database-seeding/66985/4 "2006-08-30T23:46:21Z")

</div>

On 30-Aug-06, at 3:35 PM, James M. wrote:

> How do you distinguish between test, production, and development  
> fixtures?

Yeah, you don’t. At least, there’s no easy way to do it that I know  
of. I was more or less thinking about the kind of data that you  
‘keep’ in your app, but that is often delegated to the database for  
easier maintenance. A good example is content for a help section…

You’re right about test data in fixtures – it should be realistic,  
not just ideal.

–  
[http://re.visioni.st](http://re.visioni.st)  
[http://quotedprintable.com](http://quotedprintable.com)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 30, 2006, 9:44pm UTC](https://www.ruby-forum.com/t/database-seeding/66985/5 "2006-08-30T21:44:04Z")

</div>

> -----Original Message-----  
> I prefer to use fixtures over migrations for this. So, you create  
> your fixtures with all your seed data, and then load them with:
> 
> rake db:fixtures:load
> 
> This approach is cool because it serves a dual purpose: it gives you  
> a place to put your seed data, and gives you realistic test data for  
> testing.

How do you distinguish between test, production, and development  
fixtures?  
I can’t imagine that they’re going to be the same.

OK, I can imagine that they’re the same for production and development,  
but  
not test. Surely test is going to have a much richer (darker, perhaps -  
some test data should be designed to find problems) set of fixtures than  
you’d want in seed data.

- James M.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 31, 2006, 3:03pm UTC](https://www.ruby-forum.com/t/database-seeding/66985/6 "2006-08-31T15:03:50Z")

</div>

on the topic of fixtures and using them to seed the database:

i have this in my migrations to populate some of my tables that  
shouldn’t be blank when my app gets deployed:

cmd = ‘rake db:fixtures:load FIXTURES=countries,provstates,employees’  
system cmd  
Employee.delete\_all “username != ‘admin’” #delete all but admin

the countries and provstates all have the real actual data that those  
tables should be seeded with… the employees table however contains my  
test entries as well as the ‘admin’ account which needs to already be  
present to get into the app and setup more stuff when deploying the  
app… the delete\_all gets rid of the extra test entries… Note: i have  
‘class Employee \< ActiveRecord::Base; end #temporary activerecord  
class’ at the top of my migrations file so i can use the Employee  
activerecord class in the migration.

hope this is helpful  
stuart

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 31, 2006, 3:49pm UTC](https://www.ruby-forum.com/t/database-seeding/66985/7 "2006-08-31T15:49:59Z")

</div>

removed\_email\_address@domain.invalid wrote:

> How are people typically seeding a database when doing a new install?
> 
> I would assume doing this with a Rake task but it could also be done  
> with migrations. Fixtures could also do this be used to do this?

I have the same question too. I have the feeling something is missing in  
Rails here. A standard way to fill your data with initial data would be  
really nice. Examples could be default users, country codes, holidays,  
…  
Of course the fixtures way works but it feels strange to use fixtures, a  
concept of testing, to load your database.  
It’s probably just a matter of coming up with a good name for a Rake  
task,  
but it’s missing imho.

Bart

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 31, 2006, 7:44pm UTC](https://www.ruby-forum.com/t/database-seeding/66985/8 "2006-08-31T19:44:45Z")

</div>

Hello,

I need to do authentication of my Rails application users against an  
existing RADIUS. I’m using the salted-login-generator as the base of my  
user-system and tried to get this working with RADIUSlib-0.5. But  
RADIUSlib seems to be very UNIX-specific and there’s a lot of work of  
reimplementing to do, to get this up and running. I don’t know, if  
radiusaaa is any better (in the meaning of “closer to windows”) than  
RADIUSlib. Additionally the project-homepage seems to be empty (no  
downloadable files).

Are there any experiences with implementations of RADIUS-Clients on  
Windows? Any advice would be appreciated!

Regards

Horst
