# Generate a couple hundred rows of dummy data - how?

**URL:** <https://www.ruby-forum.com/t/generate-a-couple-hundred-rows-of-dummy-data-how/49761>\
**Category:** Rails\
**Created:** [December 8, 2005, 3:35pm UTC](https://www.ruby-forum.com/t/generate-a-couple-hundred-rows-of-dummy-data-how/49761 "2005-12-08T15:35:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![df-sean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@df-sean](https://www.ruby-forum.com/u/df-sean)\
**Post date:** [December 8, 2005, 3:35pm UTC](https://www.ruby-forum.com/t/generate-a-couple-hundred-rows-of-dummy-data-how/49761/1 "2005-12-08T15:35:17Z")

</div>

Simple task – I’ve done some custom pagination and I need to fill up a  
table with a bunch of rows so I can play around with the back and next  
buttons. Is there an easy way from the command line perhaps to just  
fire off a couple hundred copies of an existing table row? Thanks!

---

<div class="post-metadata">

**Author:** ![df-sean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@df-sean](https://www.ruby-forum.com/u/df-sean)\
**Post date:** [December 8, 2005, 3:48pm UTC](https://www.ruby-forum.com/t/generate-a-couple-hundred-rows-of-dummy-data-how/49761/2 "2005-12-08T15:48:19Z")

</div>

On 12/8/05, Sean S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Simple task – I’ve done some custom pagination and I need to fill up a  
> table with a bunch of rows so I can play around with the back and next  
> buttons. Is there an easy way from the command line perhaps to just  
> fire off a couple hundred copies of an existing table row? Thanks!

Fire up script/console

1000.times do  
Article.create :body =\> ‘Article body text’, whatever else here  
end

Should create a thousand articles for you.

---

<div class="post-metadata">

**Author:** ![df-sean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@df-sean](https://www.ruby-forum.com/u/df-sean)\
**Post date:** [December 8, 2005, 3:52pm UTC](https://www.ruby-forum.com/t/generate-a-couple-hundred-rows-of-dummy-data-how/49761/3 "2005-12-08T15:52:23Z")

</div>

Sean,

I’d use script/console. Example:

i = Item.find(:first)  
30.times { i.clone.save }

Cody

On 12/8/05, Sean S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
[http://www.codyfauser.com](http://www.codyfauser.com)

---

<div class="post-metadata">

**Author:** ![df-sean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@df-sean](https://www.ruby-forum.com/u/df-sean)\
**Post date:** [December 8, 2005, 4:16pm UTC](https://www.ruby-forum.com/t/generate-a-couple-hundred-rows-of-dummy-data-how/49761/4 "2005-12-08T16:16:05Z")

</div>

Thanks so much guys. Cody’s tip was exactly what I was looking for.  
Three helpful responses within 20 minutes of my post! Oh I do love the  
Rails community. Cheers 🙂

---

<div class="post-metadata">

**Author:** ![df-sean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@df-sean](https://www.ruby-forum.com/u/df-sean)\
**Post date:** [December 8, 2005, 3:56pm UTC](https://www.ruby-forum.com/t/generate-a-couple-hundred-rows-of-dummy-data-how/49761/5 "2005-12-08T15:56:31Z")

</div>

If it’s in a test framework, you can do something like this:

200.times do  
MyModel.new({…}).save  
end
