Permalink
Browse files

Use default charset/collation only if *neither* is specified. Otherwi…

…se we set utf8_unicode_ci collation on latin1 table.
  • Loading branch information...
1 parent 96ded2e commit 57bdafb932e891e3a732ad3ea31349f61833b126 @jeremy jeremy committed Sep 21, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 activerecord/lib/active_record/tasks/mysql_database_tasks.rb
@@ -73,11 +73,14 @@ def configuration_without_database
configuration.merge('database' => nil)
end
+ # If neither encoding nor collation is specified, use the utf-8 defaults.
def creation_options
- {
- charset: (configuration['encoding'] || DEFAULT_CHARSET),
- collation: (configuration['collation'] || DEFAULT_COLLATION)
- }
+ options = configuration.slice('encoding', 'collation').symbolize_keys
+ if options.empty?
+ { charset: DEFAULT_CHARSET, collation: DEFAULT_COLLATION }
+ else
+ options
+ end
end
def error_class

0 comments on commit 57bdafb

Please sign in to comment.