DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
DRYing Up YAML Fixtures
// Rails Recipes explained how to DRY up the database configuration code. I applied the same idea to user fixtures, which worked while we used MySQL. Once on Postgres, "defaults" started throwing an error. The easiest solution was to make quentin's values the 'defaults'
quentin: &defaults id: 1 login: quentin email: quentin@example.com site_id: 1 salt: 7e3041ebc2fc05a40c60028e2c4901a81035d3cd crypted_password: 00742970dc9e6319f8019fd54864d3ea740f04b1 # test created_at: <%= 5.days.ago.to_s :db %> activated_at: <%= 5.days.ago.to_s :db %> # only if you're activating new signups aaron: id: 2 login: aaron email: aaron@example.com activation_code: aaronscode site_id: 1 <<: *defaults #etc...




