Skip to content
This repository
Browse code

small refactoring, added blob_or_text_colum? in AbstractMysqlAdapter

  • Loading branch information...
commit 6415d3ac539a058285e1005cb147d4d344c8ce12 1 parent 70e3ee3
Angelo Capilleri acapilleri authored
8 activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
@@ -14,7 +14,7 @@ def initialize(name, default, sql_type = nil, null = true, collation = nil, stri
14 14 end
15 15
16 16 def extract_default(default)
17   - if sql_type =~ /blob/i || type == :text
  17 + if blob_or_text_column?
18 18 if default.blank?
19 19 null || strict ? nil : ''
20 20 else
@@ -28,9 +28,13 @@ def extract_default(default)
28 28 end
29 29
30 30 def has_default?
31   - return false if sql_type =~ /blob/i || type == :text #mysql forbids defaults on blob and text columns
  31 + return false if blob_or_text_column? #mysql forbids defaults on blob and text columns
32 32 super
33 33 end
  34 +
  35 + def blob_or_text_column?
  36 + sql_type =~ /blob/i || type == :text
  37 + end
34 38
35 39 # Must return the relevant concrete adapter
36 40 def adapter

0 comments on commit 6415d3a

Please sign in to comment.
Something went wrong with that request. Please try again.