From cd32f252a3d9a3448f099c3b96037c1f2fc416d1 Mon Sep 17 00:00:00 2001 From: Larissa Reis Date: Mon, 28 Oct 2013 10:09:12 -0300 Subject: [PATCH] changes ugly code to be, what i think is, more ruby-like --- app/helpers/application_helper.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 943ec2d..4c40a2a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -728,12 +728,11 @@ module ApplicationHelper def rolename_for(profile, resource) roles = profile.role_assignments.select{ |a| a.resource_id == resource.id }.sort_by{ |s| s.role_id }.map(&:role) - names = '' + names = [] roles.each do |role| - names += content_tag('span', role.name, :style => "color: #{role_color(role, resource.environment.id)}") - names += ', ' + names << content_tag('span', role.name, :style => "color: #{role_color(role, resource.environment.id)}") end - names.slice 0..-3 + names.join(', ') end def role_color(role, env_id) -- libgit2 0.21.2