From 47f1c10c8fb7ed9f8999dda5b4a7f42e34afeec6 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Tue, 10 Jun 2014 08:42:47 -0600 Subject: Keep the types of virtual columns after yaml serialization On MySQL and PostgreSQL, the adapter does not type cast virtual columns for us. --- activerecord/lib/active_record/connection_adapters/column.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'activerecord/lib/active_record/connection_adapters/column.rb') diff --git a/activerecord/lib/active_record/connection_adapters/column.rb b/activerecord/lib/active_record/connection_adapters/column.rb index 72c6990ba5..21273364b9 100644 --- a/activerecord/lib/active_record/connection_adapters/column.rb +++ b/activerecord/lib/active_record/connection_adapters/column.rb @@ -13,7 +13,7 @@ module ActiveRecord ISO_DATETIME = /\A(\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)(\.\d+)?\z/ end - attr_reader :name, :cast_type, :null, :sql_type, :default_function + attr_reader :name, :cast_type, :sql_type, :default_function delegate :type, :precision, :scale, :limit, :klass, :accessor, :text?, :number?, :binary?, :serialized?, :changed?, @@ -34,7 +34,7 @@ module ActiveRecord @name = name @cast_type = cast_type @sql_type = sql_type - @null = null + @nullable = null @original_default = default @default_function = nil end @@ -61,6 +61,10 @@ module ActiveRecord clone.instance_variable_set('@cast_type', type) end end + + def null + @nullable + end end class NullColumn < Column -- cgit v1.2.3