8000 Remove redundant safe navigation operator · activeadmin/activeadmin@e49f86e · GitHub
[go: up one dir, main page]

Skip to content

Commit e49f86e

Browse files
committed
Remove redundant safe navigation operator
Remove redundant safe navigation operator (`&.`) in `result.to_s.strip.present?` check, as `to_s` handles `nil` gracefully by converting it to an empty string. This makes the code cleaner and more idiomatic without altering behavior. Ref: https://ruby-doc.org/core-3.1.0/Object.html#method-i-to_s
1 parent b86bbbf commit e49f86e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/helpers/active_admin/display_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def DISPLAY_NAME_FALLBACK.inspect
2424
def display_name(resource)
2525
unless resource.nil?
2626
result = render_in_context(resource, display_name_method_for(resource))
27-
if result.to_s&.strip&.present?
27+
if result.to_s.strip.present?
2828
ERB::Util.html_escape(result)
2929
else
3030
ERB::Util.html_escape(render_in_context(resource, DISPLAY_NAME_FALLBACK))

0 commit comments

Comments
 (0)
0