Class: ActiveRecord::ConnectionAdapters::MysqlColumn
- Defined in:
- lib/active_record/connection_adapters/mysql_adapter.rb
Overview
:nodoc:
Constant Summary
Constants inherited from Column
Column::FALSE_VALUES, Column::TRUE_VALUES
Instance Attribute Summary
Attributes inherited from Column
#default, #limit, #name, #null, #precision, #primary, #scale, #sql_type, #type
Instance Method Summary collapse
Methods inherited from Column
binary_to_string, #human_name, #initialize, #klass, #number?, string_to_binary, string_to_date, string_to_dummy_time, string_to_time, #text?, #type_cast, #type_cast_code, value_to_boolean, value_to_decimal
Constructor Details
This class inherits a constructor from ActiveRecord::ConnectionAdapters::Column
Instance Method Details
#extract_default(default) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/active_record/connection_adapters/mysql_adapter.rb', line 42 def extract_default(default) if sql_type =~ /blob/i || type == :text if default.blank? return null ? nil : '' else raise ArgumentError, "#{type} columns cannot have a default value: #{default.inspect}" end elsif missing_default_forged_as_empty_string?(default) nil else super end end |
#has_default? ⇒ Boolean
56 57 58 59 |
# File 'lib/active_record/connection_adapters/mysql_adapter.rb', line 56 def has_default? return false if sql_type =~ /blob/i || type == :text #mysql forbids defaults on blob and text columns super end |