Friday, May 21, 2010

Using YAML to Move ActiveRecord Objects Between Rails Installations

So I was trying to get some ActiveRecord objects from the server to my local box. This is not the right or cleverest way to do it, but it works.

On the server I just did 

Then I moved to the file to local via ssh and fired up a local Rails console.

I read the file in

and then I realized that I had these weird YAML objects and no time to actually read any documentation on how they work. But thanks to spelunking with inspect, this worked:

where Thinger is my ActiveRecord obj. Now I'm locked and loaded.

No comments: