Fixes support for database alias on database.yml #5579

Closed
wants to merge 1 commit into from

2 participants

@krsmurata

Until Rails 3.1 we could use a string to copythe same config from another database config:

development:
  adapter: postgresql
  encoding: utf8
  database: test_development
  host: localhost

production:
  development

This stopped working when @tenderlove used his refactoring sword to slice the establish_connection logic on commit 2a9a8ad

I don't know if this is the right approach to fix this issue or even if it's a issue, if you guys accept it I need to apply this patch on master as well.

@krsmurata krsmurata Fixes support for database alias on database.yml
Until Rails 3.1 we could use a string to copy
the same config from another database config:

development:
	...

production:
  development

This stopped working when @tenderlove used
his refactoring sword to slice the
establish_connection logic on commit
2a9a8ad
aa584af
@drogus
Ruby on Rails member

I guess you could just use standard yml way of doing this:

production: &production
  username: root

development: *production
@drogus
Ruby on Rails member

@krsmurata I've confirmed with some of the core team members and this is the behavior that was rather unknown for the most of developers, so it's rather not worth it to maintain it having in mind that there is already widely known pattern in YAML. Usually it's used like that:

defaults: &defaults
  adapter: postgresql
  username: root
  password:
  encoding: utf8

development:
  database: app_development
  <<: *defaults

Thanks for the pull request, though!

@drogus drogus closed this Mar 26, 2012
@krsmurata

Thanks for the feedback @drogus

Yeah, I was quite sure that it wasn't a bug since the correct notation for repeated notes on YAML is using &string and then using it as *string, but it somehow breaks an exiting not so known feature.

I agree it's not worth maintaining it if it's obsolete, maybe should be nice to have an entry on the CHANGELOG notifying about this change on 3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment