Permalink
Browse files

fix code typo in `MysqlAdapter` .Closes #12647.

Conflicts:
	activerecord/CHANGELOG.md
  • Loading branch information...
1 parent dece340 commit 5d7e865e687a0c2f9f787b46958da5b64dac051d @senny senny committed Oct 28, 2013
@@ -559,7 +559,7 @@ def version
def set_field_encoding field_name
field_name.force_encoding(client_encoding)
if internal_enc = Encoding.default_internal
- field_name = field_name.encoding(internal_enc)
+ field_name = field_name.encode!(internal_enc)
end
field_name
end
@@ -607,10 +607,25 @@ def test_attr_readonly_is_class_level_setting
end
def test_unicode_column_name
+ Weird.reset_column_information
weird = Weird.create(:なまえ => 'たこ焼き仮面')
assert_equal 'たこ焼き仮面', weird.なまえ
end
+ def test_respect_internal_encoding
+ if current_adapter?(:PostgreSQLAdapter)
+ skip 'pg does not respect internal encoding and always returns utf8'
+ end
+ old_default_internal = Encoding.default_internal
+ silence_warnings { Encoding.default_internal = "EUC-JP" }
+
+ Weird.reset_column_information
+
+ assert_equal ["EUC-JP"], Weird.columns.map {|c| c.name.encoding.name }.uniq
+ ensure
+ silence_warnings { Encoding.default_internal = old_default_internal }
+ end
+
def test_non_valid_identifier_column_name
weird = Weird.create('a$b' => 'value')
weird.reload

0 comments on commit 5d7e865

Please sign in to comment.