From 25466109200919efcbbb8dc4c72f947b891de770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 30 Jun 2014 17:41:50 -0300 Subject: Use if/else Since we are using both branches of the code is preferable to use if/else over the early return. --- actionview/lib/action_view/helpers/tags/datetime_field.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'actionview') diff --git a/actionview/lib/action_view/helpers/tags/datetime_field.rb b/actionview/lib/action_view/helpers/tags/datetime_field.rb index 4296e52f21..b2cee9d198 100644 --- a/actionview/lib/action_view/helpers/tags/datetime_field.rb +++ b/actionview/lib/action_view/helpers/tags/datetime_field.rb @@ -18,8 +18,11 @@ module ActionView end def datetime_value(value) - return value unless value.is_a? String - DateTime.parse(value) rescue nil + if value.is_a? String + DateTime.parse(value) rescue nil + else + value + end end end end -- cgit v1.2.3