aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2012-03-01 01:19:27 +0900
committerkennyj <kennyj@gmail.com>2012-03-01 01:19:27 +0900
commit5cbba30a1292dde9c83ab42287c2a1f38f3fcc44 (patch)
treea016ec1cf6dd9d90e449b8be7a06b6fdd70ee5cb /activerecord/lib/active_record/connection_adapters
parent0da12df2608969330bd47c543866f79ff8ca9edd (diff)
downloadrails-5cbba30a1292dde9c83ab42287c2a1f38f3fcc44.tar.gz
rails-5cbba30a1292dde9c83ab42287c2a1f38f3fcc44.tar.bz2
rails-5cbba30a1292dde9c83ab42287c2a1f38f3fcc44.zip
Support judgement expired schema cache dump.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r--activerecord/lib/active_record/connection_adapters/schema_cache.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/schema_cache.rb b/activerecord/lib/active_record/connection_adapters/schema_cache.rb
index 53fa404305..aad1f9a7ef 100644
--- a/activerecord/lib/active_record/connection_adapters/schema_cache.rb
+++ b/activerecord/lib/active_record/connection_adapters/schema_cache.rb
@@ -1,7 +1,7 @@
module ActiveRecord
module ConnectionAdapters
class SchemaCache
- attr_reader :columns, :columns_hash, :primary_keys, :tables
+ attr_reader :columns, :columns_hash, :primary_keys, :tables, :version
attr_accessor :connection
def initialize(conn)
@@ -36,6 +36,7 @@ module ActiveRecord
@columns_hash.clear
@primary_keys.clear
@tables.clear
+ @version = nil
end
# Clear out internal caches for table with +table_name+.
@@ -47,13 +48,15 @@ module ActiveRecord
end
def marshal_dump
- [:@columns, :@columns_hash, :@primary_keys, :@tables].map do |val|
+ # if we get current version during initialization, it happens stack over flow.
+ @version = ActiveRecord::Migrator.current_version
+ [@version] + [:@columns, :@columns_hash, :@primary_keys, :@tables].map do |val|
self.instance_variable_get(val).inject({}) { |h, v| h[v[0]] = v[1]; h }
end
end
def marshal_load(array)
- @columns, @columns_hash, @primary_keys, @tables = array
+ @version, @columns, @columns_hash, @primary_keys, @tables = array
prepare_default_proc
end