diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index 124a2419ec..52b0b3fe79 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -14,7 +14,7 @@ module ActiveRecord end def extract_default(default) - if sql_type =~ /blob/i || type == :text + if blob_or_text_column? if default.blank? null || strict ? nil : '' else @@ -28,9 +28,13 @@ module ActiveRecord end def has_default? - return false if sql_type =~ /blob/i || type == :text #mysql forbids defaults on blob and text columns + return false if blob_or_text_column? #mysql forbids defaults on blob and text columns super end + + def blob_or_text_column? + sql_type =~ /blob/i || type == :text + end # Must return the relevant concrete adapter def adapter |