aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/column.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-06-10 08:42:47 -0600
committerSean Griffin <sean@thoughtbot.com>2014-06-10 08:42:47 -0600
commit47f1c10c8fb7ed9f8999dda5b4a7f42e34afeec6 (patch)
tree25c6a517916d0b943ab0fb74e653797fa0a2d1b7 /activerecord/lib/active_record/connection_adapters/column.rb
parentbfb8b139aaeecd3aaadb99c3f483c1420e59c384 (diff)
downloadrails-47f1c10c8fb7ed9f8999dda5b4a7f42e34afeec6.tar.gz
rails-47f1c10c8fb7ed9f8999dda5b4a7f42e34afeec6.tar.bz2
rails-47f1c10c8fb7ed9f8999dda5b4a7f42e34afeec6.zip
Keep the types of virtual columns after yaml serialization
On MySQL and PostgreSQL, the adapter does not type cast virtual columns for us.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/column.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/column.rb8
1 files changed, 6 insertions, 2 deletions
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