Skip to content

Commit 044bbb3

Browse files
Simplify the commit code
1 parent d94ade3 commit 044bbb3

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

app/helpers/catalog_helper/textual_summary.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module CatalogHelper::TextualSummary
22
def tags_from_record
33
tags = []
4-
tag_categories = {}
4+
tag_categories = Hash.new { |h, k| h[k] = [] }
55
@record.tags.each do |tag|
66
values = tag.name.split('/')
77
p = tags.find { |x| x[:label] == values[2].humanize }
@@ -10,11 +10,7 @@ def tags_from_record
1010
p[:value].push(value)
1111
else
1212
name = Classification.find_by(:id => Classification.find_by(:tag_id => tag.id).parent_id).description
13-
if tag_categories[name].nil?
14-
tag_categories[name] = [value]
15-
else
16-
tag_categories[name].append(value)
17-
end
13+
tag_categories[name] << value
1814
end
1915
end
2016
tag_categories.each do |tag_category, tag_values|

0 commit comments

Comments
 (0)