diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-12-15 13:23:18 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-12-15 13:23:28 +0000 |
commit | 8dba32f125cc0b79fe453f38b1044c7bf9fb52ce (patch) | |
tree | 0e01a18f50f771a8d6967cde806b97477ebcc74c /activerecord/test/cases | |
parent | d7e714adacb18034b9121e4a05d6b119d9e6ef6a (diff) | |
download | rails-8dba32f125cc0b79fe453f38b1044c7bf9fb52ce.tar.gz rails-8dba32f125cc0b79fe453f38b1044c7bf9fb52ce.tar.bz2 rails-8dba32f125cc0b79fe453f38b1044c7bf9fb52ce.zip |
Fix #3987.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/primary_keys_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/primary_keys_test.rb b/activerecord/test/cases/primary_keys_test.rb index 8d248c3f9f..a02dcb9e1c 100644 --- a/activerecord/test/cases/primary_keys_test.rb +++ b/activerecord/test/cases/primary_keys_test.rb @@ -148,6 +148,16 @@ class PrimaryKeysTest < ActiveRecord::TestCase k.primary_key = "foo" assert_equal k.connection.quote_column_name("foo"), k.quoted_primary_key end + + def test_set_primary_key_sets_schema_cache + klass = Class.new(ActiveRecord::Base) + klass.table_name = 'fuuuuuu' + klass.connection.create_table(:fuuuuuu, :id => false) { |t| t.integer :omg } + klass.primary_key = 'omg' + assert klass.connection.schema_cache.columns_hash['fuuuuuu']['omg'].primary + ensure + klass.connection.drop_table(:fuuuuuu) if klass.table_exists? + end end class PrimaryKeyWithNoConnectionTest < ActiveRecord::TestCase |