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! -- Posted via http://www.ruby-forum.com/.
On 12/8/05, Sean Schertell <sean-ZFxOO9cya7fR7s880joybQ@public.gmane.org> 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.
Sean, I''d use script/console. Example: i = Item.find(:first) 30.times { i.clone.save } Cody On 12/8/05, Sean Schertell <sean-ZFxOO9cya7fR7s880joybQ@public.gmane.org> 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! > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- http://www.codyfauser.com
If it''s in a test framework, you can do something like this: 200.times do MyModel.new({...}).save end On Thu, 8 Dec 2005, Sean Schertell 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!
Sean Schertell
2005-Dec-08 15:16 UTC
Re: Generate a couple hundred rows of dummy data - how?
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 :-) -- Posted via http://www.ruby-forum.com/.