A Little Timesaver

Posted by trevor Sat, 17 Sep 2005 04:04:42 GMT

It seems to happen every single time I run ./script/generate model

I open the newly minted fixtures file and go “damn, what are the database columns again?” And of course, even if I could accurately remember them, why should I have to type them all in by hand?

Well, no more. ActiveRecord knows what the columns are so ActiveRecord can just darn-well tell me.


./script/runner "puts MyModel.new().to_yaml" \ 
   >> test/fixtures/my_model.yml

It gives me a lovely list of attributes to play with. Joy.