Commit eee29e44 by tady

profiler追加, treeのcount表示

parent 105b73ba
...@@ -74,3 +74,6 @@ end ...@@ -74,3 +74,6 @@ end
# tree structure # tree structure
gem 'ancestry' gem 'ancestry'
# profiler
gem 'rack-mini-profiler'
...@@ -100,6 +100,8 @@ GEM ...@@ -100,6 +100,8 @@ GEM
pg (0.17.0) pg (0.17.0)
polyglot (0.3.3) polyglot (0.3.3)
rack (1.5.2) rack (1.5.2)
rack-mini-profiler (0.1.31)
rack (>= 1.1.3)
rack-test (0.6.2) rack-test (0.6.2)
rack (>= 1.0) rack (>= 1.0)
rails (4.0.2) rails (4.0.2)
...@@ -172,6 +174,7 @@ DEPENDENCIES ...@@ -172,6 +174,7 @@ DEPENDENCIES
jbuilder (~> 1.2) jbuilder (~> 1.2)
omniauth-google-oauth2 omniauth-google-oauth2
pg pg
rack-mini-profiler
rails (~> 4.0.2) rails (~> 4.0.2)
rails_12factor rails_12factor
redcarpet! redcarpet!
......
...@@ -3,7 +3,7 @@ module PostsHelper ...@@ -3,7 +3,7 @@ module PostsHelper
# @param {ActiveRecord::Relation} node # @param {ActiveRecord::Relation} node
def h_display_tree(node) def h_display_tree(node)
_html = '<ul>' _html = '<ul>'
_html << %Q{<li><a href="#{ root_path(q: '#' + node.name) }">#{node.name}</a></li>} _html << %Q{<li><a href="#{ root_path(q: '#' + node.name) }">#{node.name} <span class="badge">#{node.post_tags.count}</span></a></li>}
node.children.each do |_child| node.children.each do |_child|
_html << h_display_tree(_child) _html << h_display_tree(_child)
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment