Marko Anastasov wrote this on February 18, 2009

Getting fixture data quickly from the database with console and #to_yaml

Whenever I’m working on a project, I keep a Rails console for it open, usually to quickly inspect our models and database. It can be very handy when you need to prepare some fixture data as well. Just grab a model instance and call"data.fix", "w") { |f| f.write foo.to_yaml }

to dump it to a file.

comments powered by Disqus

About Marko Anastasov

Rendered Text co-founder. Started with code, currently more focused on people and words. Foosball striker and entry-level cyclist.

Suggested Reads

Rails Testing Handbook

A new ebook on building test-driven Rails apps with RSpec and Cucumber.

At Rendered Text, we have a long history with Ruby on Rails. Checking the blog archive reminds me that we published first posts about working with Rails way back in 2009.


Rendered Text is a software company. For questions regarding Semaphore, please visit Otherwise, feel free to get in touch any time by sending us an email.