Substituindo a configuração do banco de dados Rails 3 dependendo da plataforma

https://gist.github.com/1418782

configuration_extensions.rb

# lib/extenstions/configuration_extentions.rb

module Rails
class Application
class Configuration

def database_configuration
require
'erb'
case RUBY_PLATFORM.downcase
when /darwin/
YAML
::load(ERB.new(IO.read('config/database_mac.yml')).result)
when /mswin/, /ming/
YAML
::load(ERB.new(IO.read('config/database_win.yml')).result)
when /java/
YAML
::load(ERB.new(IO.read('config/database_java.yml')).result)
else
YAML
::load(ERB.new(IO.read(paths["config/database"].first)).result)
end
end

end
end
end

environment.rb

# config/environment.rb

require
'extensions/configuration_extensions'

# Initialize the rails application