Changeset 5596
- Timestamp:
- 11/20/06 11:44:31 (2 years ago)
- Files:
-
- trunk/activerecord/CHANGELOG (modified) (1 diff)
- trunk/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb (modified) (2 diffs)
- trunk/activerecord/test/defaults_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r5595 r5596 7 7 * Run validations in the order they were declared. #6657 [obrie] 8 8 9 * MySQL: detect when a NOT NULL column without a default value is misreported as default ''. Can't detect for string, text, and binary columns since '' is a legitimate default. #6156 [simon@redhillconsulting.com.au, obrie, J eremy Kemper]9 * MySQL: detect when a NOT NULL column without a default value is misreported as default ''. Can't detect for string, text, and binary columns since '' is a legitimate default. #6156 [simon@redhillconsulting.com.au, obrie, Jonathan Viney, Jeremy Kemper] 10 10 11 11 * Simplify association proxy implementation by factoring construct_scope out of method_missing. #6643 [martin] trunk/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
r5586 r5596 89 89 90 90 def initialize(name, default, sql_type = nil, null = true) 91 @original_default = default 91 92 super 92 self.default = nil if missing_default_forged_as_empty_string?93 @default = nil if missing_default_forged_as_empty_string? 93 94 end 94 95 … … 108 109 # a type allowing default ''. 109 110 def missing_default_forged_as_empty_string? 110 !null && default == '' && !TYPES_ALLOWING_EMPTY_STRING_DEFAULT.include?(type)111 !null && @original_default == '' && !TYPES_ALLOWING_EMPTY_STRING_DEFAULT.include?(type) 111 112 end 112 113 end trunk/activerecord/test/defaults_test.rb
r5586 r5596 7 7 column_defaults = 8 8 if current_adapter?(:MysqlAdapter) 9 { 'id' => nil, 'name' => '', 'course_id' => 0}9 { 'id' => nil, 'name' => '', 'course_id' => nil } 10 10 else 11 11 { 'id' => nil, 'name' => nil, 'course_id' => nil }