Skip to content
Snippets Groups Projects
Commit a99ad3d3 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

tree_heleper: concat html only if present. Avoid nil exception

parent 9ba21dd0
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -13,13 +13,15 @@ module TreeHelper
tree += render partial: 'tree/tree_item', collection: folders, locals: {type: 'folder'} if folders.present?
 
files.each do |f|
if f.respond_to?(:url)
# Object is a Submodule
tree += render partial: 'tree/submodule_item', object: f
else
# Object is a Blob
tree += render partial: 'tree/tree_item', object: f, locals: {type: 'file'}
end
html = if f.respond_to?(:url)
# Object is a Submodule
render partial: 'tree/submodule_item', object: f
else
# Object is a Blob
render partial: 'tree/tree_item', object: f, locals: {type: 'file'}
end
tree += html if html.present?
end
 
tree.html_safe
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment