aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2015-05-14 12:54:25 +0100
committerGareth Rees <gareth@mysociety.org>2015-06-04 13:51:03 +0100
commit2e585703b619ee7b77132098888bb97c5f5e6483 (patch)
tree68286a1296db2fc5898dfd3402a14632198f1fb6
parent609bed69081e1f0e81662f052342d34dbe7881bb (diff)
Use each_with_index rather than state variable
-rw-r--r--app/helpers/public_body_helper.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/app/helpers/public_body_helper.rb b/app/helpers/public_body_helper.rb
index e871ea1bc..0e84711a8 100644
--- a/app/helpers/public_body_helper.rb
+++ b/app/helpers/public_body_helper.rb
@@ -39,16 +39,13 @@ module PublicBodyHelper
#
# Returns a String
def type_of_authority(public_body)
- first = true
-
categories = PublicBodyCategory.
where(:category_tag => public_body.tag_string.split)
- types = categories.map do |category|
+ types = categories.each_with_index.map do |category, index|
desc = category.description
- if first
+ if index.zero?
desc = desc.sub(/\S/) { |m| Unicode.upcase(m) }
- first = false
end
link_to(desc, list_public_bodies_path(category.category_tag))
end