ActiveBlog

Komodo Rails tools now support refactored YAML files
by

, July 17, 2007

The default database.yml file in Rails apps contains a lot of redundancy. You need to specify three different databases, and often some of the fields are the same for each one. YAML supports refactoring common data into a single structure...

The default database.yml file in Rails apps contains a lot of redundancy.  You need to specify three different databases, and often some of the fields are the same for each one.  YAML supports refactoring common data into a single structure by using the concepts it calls anchors, aliases, and merging keys. However, the Rails tools in Komodo don't use a full-fledged YAML parser, and didn't support the merge-key syntax.  With version 4.2, now in Beta, they do, and you can now use database.yml files like this one:

defaults: &defaults
  adapter: mysql
  username: root
  password: precious
  host: localhost

development:
  database: sample_development
  <<: *defaults

test:
  database: sample_test
  <<: *defaults

production:
  database: sample_production
  <<: *defaults

Subscribe to ActiveState Blogs by Email

Share this post: