aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-10-19 15:08:58 +0100
committerJon Leighton <j@jonathanleighton.com>2012-10-19 15:08:58 +0100
commitaf8c8b432abfe478f478fee35c5624c8c04d65e4 (patch)
tree180b195f1d2d8b899a5f993ffe531b45ffaf5a29 /activerecord/lib/active_record/attribute_methods
parenteb72e62c3042c0df989d951b1d12291395ebdb8e (diff)
downloadrails-af8c8b432abfe478f478fee35c5624c8c04d65e4.tar.gz
rails-af8c8b432abfe478f478fee35c5624c8c04d65e4.tar.bz2
rails-af8c8b432abfe478f478fee35c5624c8c04d65e4.zip
The default value of a text/blob in mysql strict mode should be nil
In non-strict mode it is '', but if someone is in strict mode then we should honour the strict semantics. Also, this removes the need for a completely horrible hack in dirty.rb. Closes #7780
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r--activerecord/lib/active_record/attribute_methods/dirty.rb12
1 files changed, 1 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb
index 7a5bb9e863..3417e3af17 100644
--- a/activerecord/lib/active_record/attribute_methods/dirty.rb
+++ b/activerecord/lib/active_record/attribute_methods/dirty.rb
@@ -68,17 +68,7 @@ module ActiveRecord
end
def create(*)
- if partial_updates?
- keys = keys_for_partial_update
-
- # This is an extremely bloody annoying necessity to work around mysql being crap.
- # See test_mysql_text_not_null_defaults
- keys.concat self.class.columns.select(&:explicit_default?).map(&:name)
-
- super keys
- else
- super
- end
+ partial_updates? ? super(keys_for_partial_update) : super
end
# Serialized attributes should always be written in case they've been