Class: ActiveRecord::ConnectionAdapters::Mysql2Column
- Inherits:
-
Column
- Object
- Column
- ActiveRecord::ConnectionAdapters::Mysql2Column
- Defined in:
- lib/active_record/connection_adapters/mysql2_adapter.rb
Constant Summary collapse
- BOOL =
"tinyint(1)"
Instance Method Summary collapse
Instance Method Details
#extract_default(default) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/active_record/connection_adapters/mysql2_adapter.rb', line 26 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
40 41 42 43 |
# File 'lib/active_record/connection_adapters/mysql2_adapter.rb', line 40 def has_default? return false if sql_type =~ /blob/i || type == :text # mysql forbids defaults on blob and text columns super end |