Skip to content

Commit

Permalink
use Time fallback when mass-assigning Date fields
Browse files Browse the repository at this point in the history
  • Loading branch information
al2o3cr committed Sep 25, 2011
1 parent 9593993 commit 8f8371f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hobo/lib/hobo/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,11 @@ def convert_type_for_mass_assignment(field_type, value)
if parts.include?(0)
nil
else
Date.new(*parts)
begin
Date.new(*parts)
rescue ArgumentError => ex
Time.time_with_datetime_fallback(ActiveRecord::Base.default_timezone, *parts).to_date
end
end
else
value
Expand Down

0 comments on commit 8f8371f

Please sign in to comment.