diff options
author | gbuesing <gbuesing@gmail.com> | 2008-05-08 21:30:17 -0500 |
---|---|---|
committer | gbuesing <gbuesing@gmail.com> | 2008-05-08 21:30:17 -0500 |
commit | 06a7c2948a8dbf31357b552d468fcf42002736e7 (patch) | |
tree | 94a646f54e820dff7dbad3bc0a3928b1c5731fe6 /activerecord/lib | |
parent | fb9bf16e96e2c24d4996327500d8109b5d535e2c (diff) | |
download | rails-06a7c2948a8dbf31357b552d468fcf42002736e7.tar.gz rails-06a7c2948a8dbf31357b552d468fcf42002736e7.tar.bz2 rails-06a7c2948a8dbf31357b552d468fcf42002736e7.zip |
Time.zone.parse: return nil for strings with no date information
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index fde98bf19f..2db27226f2 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -179,7 +179,7 @@ module ActiveRecord def define_write_method_for_time_zone_conversion(attr_name) method_body = <<-EOV def #{attr_name}=(time) - unless time.blank? || time.acts_like?(:time) + unless time.acts_like?(:time) time = time.is_a?(String) ? Time.zone.parse(time) : time.to_time rescue time end time = time.in_time_zone rescue nil if time |