-
-
Read About
ActionScript3 adobe flex Ajax apache band bash csrf custom Facebook API flash flex GeSHi highlight javascript jquery linux marketing Music myspace MySQL os x Photoshop php plugin profile rails rounded rounded corners ruby Ruby On Rails rubyonrails scripts Software statistics syntax syntax-highlight testing time_select validation widget wordpress work wp-syntax XHTML/CSS XML -
Facebook Me
Tony Amoyal's Profile

Converting Table Data to YAML for Testing in Ruby on Rails
One of my clients has a huge application with no test suite. I am helping the company migrate to Rails 2.3 as well as remove some bottlenecks from their code. I needed to convert around 10 look-up tables to YAML’s so that I could load the data as fixtures and test the application properly as I make changes. I scraped together pieces of code from the web and came up with this:
To use, put this code in a file somewhere like RAILS_ROOT/lib/tasks/util/table_to_yml.rake and execute something like:
rake db:fixtures:dump TABLES=lookup_table_1,lookup_table_2,...,lookup_table_nIf you enjoyed this post, make sure you subscribe to my RSS feed!