13 Feb '12, 1pm

How to apply what you've learned from TDD to writing data migrations

February 13, 2012 Tagged: ruby tdd migrations Comments (View) How to apply what you’ve learned from TDD to writing data migrations After doing TDD full time for years, I have a hard time writing code without a test. One example that I find particularly difficult is writing data migrations. Some schema changes require more than just setting a default value for all existing rows. For example, let’s say you have this schema: create_table :users do |table| table.string :email table.string :encrypted_password end create_table :posts do |table| table.integer :user_id table.boolean :published table.string :message end If you want to find the top ten users based on the number of published posts, you can do a JOIN with a COUNT and a GROUP BY clause, but over time that could get slow or just annoying, so you decide to add a cache column: add_column :users, :published_posts_count, :i...

Full article: http://robots.thoughtbot.com/post/17549345094/how-to-appl...

Tweets

Blog Post Writing in the Zone

Blog Post Writing in the Zone

searchenginepeople.com 13 Feb '12, 5pm

Minimize distractions and interactions as much as possible. Of course you can't abandon your kid at the soccer field, but ...

Check out my article on @PGA_com about the Pebb...

pga.com 13 Feb '12, 4am

Watching the AT&T Pebble Beach Pro Am this week, there were more than a few things that stuck out to me. The importantce o...

Episode 324: Passing Data to JavaScript

railscasts.com 14 Feb '12, 8am

There are a variety of ways to pass variables from a Rails application to JavaScript. Here I show three techniques: a scri...

Data Visualization Principles: Lessons from Tufte

Data Visualization Principles: Lessons from Tufte

seomoz.org 13 Feb '12, 6am

As I stated earlier, and as you've probably seen, data visualization is a super-effective and shareable form of content cr...

Lesson Learned: What can you take away from Phi...

pga.com 13 Feb '12, 4pm

Watching the AT&T Pebble Beach Pro Am this week, there were more than a few things that stuck out to me. The importantce o...

Lessons Learned by an Over-Optimizer

seomoz.org 20 Feb '12, 7pm

Congratulations on your first YouMoz post! I've spent quite a lot of time undoing this problem for clients who made the sa...