Permalink
Browse files

Merge pull request #8644 from acapilleri/abstract_mysql

small refactoring, added blob_or_text_colum? in AbstractMysqlAdapter
  • Loading branch information...
2 parents 70e3ee3 + 6415d3a commit ac6594921f4d8532b41a956e90ca56aa05f941be @rafaelfranca rafaelfranca committed Dec 28, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 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
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 @@ def extract_default(default)
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

0 comments on commit ac65949

Please sign in to comment.