Posted by Daniel Tue, 07 Aug 2007 01:41:00 GMT

I was playing around with script/console for a few minutes at the end of the day at work… and I wanted to check a couple of assumptions… one is that YAML is available! So hard to read ActiveRecord objects like this:

=> #"", "updated_at"=>"2007-06-05 21:11:37", "route"=>"", "title"=>"test",
 "ride_type"=>"road", "id"=>"1", "elapsed_time"=>"21:11:00",
 "created_at"=>"2006-06-05 16:55:00", "mileage"=>nil}>

can be displayed like this

--- !ruby/object:Ride 
attributes: 
  partners: ""
  updated_at: 2007-06-05 21:11:37
  route: ""
  title: test
  ride_type: road
  id: "1"
  elapsed_time: "21:11:00"
  created_at: 2006-06-05 16:55:00
  mileage: 

simply by typing this: y Ride.find(1)

Naturally it works with any object…

Second cool thing I looked up was Mike Clark’s post about the app.class for experiencing your app and exercising controllers…

And the last thing is is that if you need to change your code, instead of killing and restarting the console you can type “reload!” and it will do just that.