diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-05-07 07:52:08 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-05-07 07:52:08 +0000 |
commit | d08d89c09285ac6c65273c935a1afbbc983f7544 (patch) | |
tree | f81cdd5bbc2539eeeb04069c44ca175d1bc86273 /activerecord/lib | |
parent | d59f3a78a423064f53dadd9f55d05b5f7b2b240e (diff) | |
download | rails-d08d89c09285ac6c65273c935a1afbbc983f7544.tar.gz rails-d08d89c09285ac6c65273c935a1afbbc983f7544.tar.bz2 rails-d08d89c09285ac6c65273c935a1afbbc983f7544.zip |
Dates and times interpret empty strings as nil rather than 2000-01-01. Closes #4830.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4327 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index 16a41446a8..6e80707528 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -115,6 +115,7 @@ module ActiveRecord def self.string_to_dummy_time(string) return string unless string.is_a?(String) + return nil if string.empty? time_array = ParseDate.parsedate(string) # pad the resulting array with dummy date information time_array[0] = 2000; time_array[1] = 1; time_array[2] = 1; @@ -175,7 +176,7 @@ module ActiveRecord private def type_to_sql(name, limit) base.type_to_sql(name, limit) rescue name - end + end def add_column_options!(sql, options) base.add_column_options!(sql, options.merge(:column => self)) |