diff options
author | Jeremy Daer <jeremydaer@gmail.com> | 2016-04-19 00:45:30 -0700 |
---|---|---|
committer | Jeremy Daer <jeremydaer@gmail.com> | 2016-04-19 00:45:30 -0700 |
commit | 4d635bd6e86f2728419cfc4c56f9a4c6bde8aeae (patch) | |
tree | 7e267487422ee329ecb927bd8b9255ec689eda60 /activesupport/lib | |
parent | ca13731e617180a0d7fde3c2a3d73dc396b6bda7 (diff) | |
parent | 29e876f775a5bae0a8bf60c9ec75d89681717a9c (diff) | |
download | rails-4d635bd6e86f2728419cfc4c56f9a4c6bde8aeae.tar.gz rails-4d635bd6e86f2728419cfc4c56f9a4c6bde8aeae.tar.bz2 rails-4d635bd6e86f2728419cfc4c56f9a4c6bde8aeae.zip |
Merge pull request #24552 from yui-knk/raise_argument_error
Raise `ArgumentError` when an invalid form is passed to `Date#to_time`
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/date/conversions.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/conversions.rb b/activesupport/lib/active_support/core_ext/date/conversions.rb index ed8bca77ac..9a6d7bb415 100644 --- a/activesupport/lib/active_support/core_ext/date/conversions.rb +++ b/activesupport/lib/active_support/core_ext/date/conversions.rb @@ -80,6 +80,7 @@ class Date # # date.to_time(:utc) # => 2007-11-10 00:00:00 UTC def to_time(form = :local) + raise ArgumentError, "Expected :local or :utc, got #{form.inspect}." unless [:local, :utc].include?(form) ::Time.send(form, year, month, day) end |