aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/column.rb
diff options
context:
space:
mode:
authorKir Shatrov <shatrov@me.com>2016-11-13 22:18:14 -0500
committerKir Shatrov <shatrov@me.com>2016-11-27 22:09:58 -0500
commit4c00c6ed230e6fdc6199dfba43f6da1e741a02aa (patch)
tree6bbbc866f6c9061bd63ef45d5279c6e14d612654 /activerecord/lib/active_record/connection_adapters/column.rb
parent6d6249b1c1abda4f62fafcc42a7ece570c8da7e9 (diff)
downloadrails-4c00c6ed230e6fdc6199dfba43f6da1e741a02aa.tar.gz
rails-4c00c6ed230e6fdc6199dfba43f6da1e741a02aa.tar.bz2
rails-4c00c6ed230e6fdc6199dfba43f6da1e741a02aa.zip
Use YAML to serialize schema cache
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/column.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/column.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/column.rb b/activerecord/lib/active_record/connection_adapters/column.rb
index 02d546209d..61cd7ae4cc 100644
--- a/activerecord/lib/active_record/connection_adapters/column.rb
+++ b/activerecord/lib/active_record/connection_adapters/column.rb
@@ -40,6 +40,28 @@ module ActiveRecord
Base.human_attribute_name(@name)
end
+ def init_with(coder)
+ @name = coder["name"]
+ @table_name = coder["table_name"]
+ @sql_type_metadata = coder["sql_type_metadata"]
+ @null = coder["null"]
+ @default = coder["default"]
+ @default_function = coder["default_function"]
+ @collation = coder["collation"]
+ @comment = coder["comment"]
+ end
+
+ def encode_with(coder)
+ coder["name"] = @name
+ coder["table_name"] = @table_name
+ coder["sql_type_metadata"] = @sql_type_metadata
+ coder["null"] = @null
+ coder["default"] = @default
+ coder["default_function"] = @default_function
+ coder["collation"] = @collation
+ coder["comment"] = @comment
+ end
+
def ==(other)
other.is_a?(Column) &&
attributes_for_hash == other.attributes_for_hash