Skip to content
Browse files

Fixed charset/collation for rake db:create (closes #11331) [matt]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9170 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 92cd881 commit c4be0dbca96797547a9673368d17de22bdec52b7 @dhh dhh committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 railties/lib/tasks/databases.rake
View
4 railties/lib/tasks/databases.rake
@@ -37,10 +37,10 @@ namespace :db do
@collation = ENV['COLLATION'] || 'utf8_general_ci'
begin
ActiveRecord::Base.establish_connection(config.merge({'database' => nil}))
- ActiveRecord::Base.connection.create_database(config['database'], {:charset => (config['database']['charset'] || @charset), :collation => (config['database']['charset'] || @collation)})
+ ActiveRecord::Base.connection.create_database(config['database'], {:charset => (config['charset'] || @charset), :collation => (config['collation'] || @collation)})
ActiveRecord::Base.establish_connection(config)
rescue
- $stderr.puts "Couldn't create database for #{config.inspect}, charset: #{@charset}, collation: #{@collation} (if you set the charset manually, make sure you have a matching collation)"
+ $stderr.puts "Couldn't create database for #{config.inspect}, charset: #{config['charset'] || @charset}, collation: #{config['collation'] || @collation} (if you set the charset manually, make sure you have a matching collation)"
end
when 'postgresql'
`createdb "#{config['database']}" -E utf8`

0 comments on commit c4be0db

Please sign in to comment.
Something went wrong with that request. Please try again.