]> source.dussan.org Git - redmine.git/commitdiff
Unreachable branch in ApplicationHelper#format_object due to the use of the deprecate...
authorGo MAEDA <maeda@farend.jp>
Thu, 12 Jan 2023 04:04:22 +0000 (04:04 +0000)
committerGo MAEDA <maeda@farend.jp>
Thu, 12 Jan 2023 04:04:22 +0000 (04:04 +0000)
Patch by Go MAEDA.

git-svn-id: https://svn.redmine.org/redmine/trunk@22041 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb

index 316700270833ba4efc3da60e1b45c9e18dc88975..fac31d569d11de16828aa782e4ccac932dd4e08b 100644 (file)
@@ -255,31 +255,31 @@ module ApplicationHelper
     if block
       object = yield object
     end
-    case object.class.name
-    when 'Array'
+    case object
+    when Array
       formatted_objects = object.map {|o| format_object(o, html)}
       html ? safe_join(formatted_objects, ', ') : formatted_objects.join(', ')
-    when 'Time'
+    when Time
       format_time(object)
-    when 'Date'
+    when Date
       format_date(object)
-    when 'Fixnum'
+    when Integer
       object.to_s
-    when 'Float'
+    when Float
       sprintf "%.2f", object
-    when 'User', 'Group'
+    when User, Group
       html ? link_to_principal(object) : object.to_s
-    when 'Project'
+    when Project
       html ? link_to_project(object) : object.to_s
-    when 'Version'
+    when Version
       html ? link_to_version(object) : object.to_s
-    when 'TrueClass'
+    when TrueClass
       l(:general_text_Yes)
-    when 'FalseClass'
+    when FalseClass
       l(:general_text_No)
-    when 'Issue'
+    when Issue
       object.visible? && html ? link_to_issue(object) : "##{object.id}"
-    when 'Attachment'
+    when Attachment
       if html
         content_tag(
           :span,
@@ -294,7 +294,7 @@ module ApplicationHelper
       else
         object.filename
       end
-    when 'CustomValue', 'CustomFieldValue'
+    when CustomValue, CustomFieldValue
       return "" unless object.customized&.visible?
 
       if object.custom_field