When creating YAML fixtures, there are many records that have many repeated values. For example:
user_1:
name: john
is_active: true
user_2:
name: billy
is_active: true
Here, the is_active field is repeated many times and has the same value true. This may be a default for many records. YAML allows you to set defaults:
defaults: &defaults
is_active: true
user_1:
name: john
<<: *defaults
user_2:
name: billy
<<: *defaults
Obviously, this simple example doesn't save us any time. However, if our defaults include many columns, this can save a lot of typing and headaches when default values need to be changed.
All this is wondeful... EXCEPT when your using PostgreSQL, and it's driving me NUTS!!! For some reason, this DRY method doesn't work. I haven't figured out why yet and my search for the answer has been rather futile. If any one has an answer, I'd like to know the reason.
W
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment