diff options
author | Akira Matsuda <ronnie@dio.jp> | 2019-08-01 16:41:26 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2019-08-01 17:58:00 +0900 |
commit | af2129b4c74732c88ffce76e5c55c805cb9431f6 (patch) | |
tree | c74d8c85f81ea6b3a5e4209be247c9d83666bd4d /actionview/lib/action_view/helpers/tags/time_field.rb | |
parent | dbf3e4882f9da95e34ed9086f182cf424aaac224 (diff) | |
download | rails-af2129b4c74732c88ffce76e5c55c805cb9431f6.tar.gz rails-af2129b4c74732c88ffce76e5c55c805cb9431f6.tar.bz2 rails-af2129b4c74732c88ffce76e5c55c805cb9431f6.zip |
Use `try` only when we're unsure if the receiver would respond_to the method
Diffstat (limited to 'actionview/lib/action_view/helpers/tags/time_field.rb')
-rw-r--r-- | actionview/lib/action_view/helpers/tags/time_field.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/tags/time_field.rb b/actionview/lib/action_view/helpers/tags/time_field.rb index e74c578db9..e5e0b84891 100644 --- a/actionview/lib/action_view/helpers/tags/time_field.rb +++ b/actionview/lib/action_view/helpers/tags/time_field.rb @@ -6,7 +6,7 @@ module ActionView class TimeField < DatetimeField # :nodoc: private def format_date(value) - value.try(:strftime, "%T.%L") + value&.strftime("%T.%L") end end end |