diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-01-31 00:20:05 -0800 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-01-31 08:23:25 +0000 |
commit | c472843bbc498fc0a21cb883c3929e191e061b3c (patch) | |
tree | 27901d73a4537d0d86d8f2afc89d83f8245fd606 /activerecord/test | |
parent | 413790559c6d803b89eb5daf7d0dff39d8f7c991 (diff) | |
download | rails-c472843bbc498fc0a21cb883c3929e191e061b3c.tar.gz rails-c472843bbc498fc0a21cb883c3929e191e061b3c.tar.bz2 rails-c472843bbc498fc0a21cb883c3929e191e061b3c.zip |
Merge pull request #4763 from kennyj/fix_4754
[MySQL] Fix GH #4754. Remove double-quote characters around PK when using sql_mode=ANSI_QUOTES
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/primary_keys_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/primary_keys_test.rb b/activerecord/test/cases/primary_keys_test.rb index 0669707baf..bf8aacc363 100644 --- a/activerecord/test/cases/primary_keys_test.rb +++ b/activerecord/test/cases/primary_keys_test.rb @@ -200,3 +200,19 @@ class PrimaryKeyWithNoConnectionTest < ActiveRecord::TestCase assert_equal 'foo', model.primary_key end end + +if current_adapter?(:MysqlAdapter) or current_adapter?(:Mysql2Adapter) + class PrimaryKeyWithAnsiQuotesTest < ActiveRecord::TestCase + self.use_transactional_fixtures = false + + def test_primaery_key_method_with_ansi_quotes + con = ActiveRecord::Base.connection + con.execute("SET SESSION sql_mode='ANSI_QUOTES'") + assert_equal "id", con.primary_key("topics") + ensure + con.reconnect! + end + + end +end + |