aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/schema_cache.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/schema_cache.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/schema_cache.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/schema_cache.rb b/activerecord/lib/active_record/connection_adapters/schema_cache.rb
index 5b598620d3..07453b4403 100644
--- a/activerecord/lib/active_record/connection_adapters/schema_cache.rb
+++ b/activerecord/lib/active_record/connection_adapters/schema_cache.rb
@@ -114,6 +114,17 @@ module ActiveRecord
@indexes.delete name
end
+ def marshal_dump
+ # if we get current version during initialization, it happens stack over flow.
+ @version = connection.migration_context.current_version
+ [@version, @columns, @columns_hash, @primary_keys, @data_sources, @indexes]
+ end
+
+ def marshal_load(array)
+ @version, @columns, @columns_hash, @primary_keys, @data_sources, @indexes = array
+ @indexes = @indexes || {}
+ end
+
private
def prepare_data_sources
connection.data_sources.each { |source| @data_sources[source] = true }