aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-12-16 13:51:46 +0000
committerJon Leighton <j@jonathanleighton.com>2011-12-16 13:52:07 +0000
commit7b1eeea5bc69747b5bfde2af2c7245339da2be74 (patch)
tree9c7cef95d23047079c8ac5be1bca58f98d338839 /activerecord
parent7f20bb995aa34c6c6869543209595ff811e9dbc3 (diff)
downloadrails-7b1eeea5bc69747b5bfde2af2c7245339da2be74.tar.gz
rails-7b1eeea5bc69747b5bfde2af2c7245339da2be74.tar.bz2
rails-7b1eeea5bc69747b5bfde2af2c7245339da2be74.zip
Should clear the primary keys cache also
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/schema_cache.rb1
-rw-r--r--activerecord/test/cases/connection_adapters/schema_cache_test.rb6
2 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/schema_cache.rb b/activerecord/lib/active_record/connection_adapters/schema_cache.rb
index da507fd3ae..4e8932a695 100644
--- a/activerecord/lib/active_record/connection_adapters/schema_cache.rb
+++ b/activerecord/lib/active_record/connection_adapters/schema_cache.rb
@@ -34,6 +34,7 @@ module ActiveRecord
def clear!
@columns.clear
@columns_hash.clear
+ @primary_keys.clear
@tables.clear
end
diff --git a/activerecord/test/cases/connection_adapters/schema_cache_test.rb b/activerecord/test/cases/connection_adapters/schema_cache_test.rb
index cd98bf90cf..42e39d534c 100644
--- a/activerecord/test/cases/connection_adapters/schema_cache_test.rb
+++ b/activerecord/test/cases/connection_adapters/schema_cache_test.rb
@@ -26,14 +26,18 @@ module ActiveRecord
assert_equal columns_hash, @cache.columns_hash['posts']
end
- def test_clearing_column_cache
+ def test_clearing
@cache.columns['posts']
@cache.columns_hash['posts']
+ @cache.tables['posts']
+ @cache.primary_keys['posts']
@cache.clear!
assert_equal 0, @cache.columns.size
assert_equal 0, @cache.columns_hash.size
+ assert_equal 0, @cache.tables.size
+ assert_equal 0, @cache.primary_keys.size
end
end
end