slurp or dump a table to yml

I'm looking for a way to slurp or dump a table to a yml file.

I have found several 'backup' procedures but they cause problems with my join tables and I just want to dump a couple of the join tables anyway.

Is there some easy way to do this?

Craig

I just tried this in script/console:

$ ./script/console Loading development environment (Rails 2.0.2)

File.open "users.txt", "w" do |file|

?> User.all.each do |user| ?> file.write user.to_yaml

end end

=> [...bunch of users...]

exit

$ ls Capfile app/ data/ doc/ lib/ public/ spec/ test/ users.txt Rakefile config/ db/ flex/ log/ script/ stories/ tmp/ vendor/ $

The file was created at the root of my rails app. I don't know if there are better ways to do it, but that was certainly quick.

Regards, Craig

I just tried this in script/console:

$ ./script/console Loading development environment (Rails 2.0.2) >> File.open "users.txt", "w" do |file| ?> User.all.each do |user| ?> file.write user.to_yaml >> end >> end => [...bunch of users...] >> exit $ ls Capfile app/ data/ doc/ lib/ public/ spec/ test/ users.txt Rakefile config/ db/ flex/ log/ script/ stories/ tmp/ vendor/ $

The file was created at the root of my rails app. I don't know if there are better ways to do it, but that was certainly quick.

I just tried this in script/console:

$ ./script/console Loading development environment (Rails 2.0.2) >> File.open "users.txt", "w" do |file| ?> User.all.each do |user| ?> file.write user.to_yaml >> end >> end => [...bunch of users...] >> exit $ ls Capfile app/ data/ doc/ lib/ public/ spec/ test/ users.txt Rakefile config/ db/ flex/ log/ script/ stories/ tmp/ vendor/ $

The file was created at the root of my rails app. I don't know if there are better ways to do it, but that was certainly quick.