From 8a422412d650846b8a6b6fcafdac6fbb9f9e1731 Mon Sep 17 00:00:00 2001 From: James Mason Date: Mon, 7 May 2018 17:24:49 -0700 Subject: [PATCH] Simplify helper (and remove alteration of string literal) --- app/helpers/application_helper.rb | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 67995187..3f01ba46 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -62,17 +62,7 @@ module ApplicationHelper end def difficulty_levels(conference) - all = conference.program.difficulty_levels.map {|t| t.title} - first = all[0...-1] - last = all[-1] - ts = '' - if all.length > 1 - ts << first.join(', ') - ts << " and #{last}" - else - ts = all.join - end - ts + conference.program.difficulty_levels.map(&:title).to_sentence end def unread_notifications(user)