Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Most of configuration files in ruby such as Gemfile, gemspec, are just ruby code itself. Why database configuration file in rails is the exception?

share|improve this question
up vote 2 down vote accepted

Personal theory is ruby code is scary to administrators, and the one configuration file they would often have to mess with is the database configuration. YAML is a bit more approachable.

share|improve this answer
BTW: Rails actually preprocesses database.yml with ERb, so you can put any Ruby you want in there :-) – Jörg W Mittag Mar 29 '12 at 14:59

One bonus is that other languages can read YAML, while you can't read a ruby config file in Python (easily).

That said I'd use ruby for complex config setups

share|improve this answer

My guess:

For configuration of a common module across environments it is the most concise way of doing so. To do it in Ruby adds more complexity to the file.

You would have to ask the original designer though to get the real answer.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.