From 040e81ece75dec6e56f469540e4ff467ce5b3b38 Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Fri, 29 Mar 2013 15:38:43 +0000 Subject: [PATCH] Show number of posts on this layer --- app/controllers/layers_controller.rb | 3 +++ app/views/layers/show.html.haml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/layers_controller.rb b/app/controllers/layers_controller.rb index e95fe31..fbc631e 100644 --- a/app/controllers/layers_controller.rb +++ b/app/controllers/layers_controller.rb @@ -19,6 +19,9 @@ class LayersController < ApplicationController @feed = Feed.new @feed.new_layer_id = @layer.id + @layer_posts = 0 + @layer.feeds.each { |f| @layer_posts += f.posts.size } + respond_to do |format| format.html # show.html.erb format.json { render json: @layer } diff --git a/app/views/layers/show.html.haml b/app/views/layers/show.html.haml index d1ef20f..562e29b 100644 --- a/app/views/layers/show.html.haml +++ b/app/views/layers/show.html.haml @@ -42,7 +42,7 @@ %tr %td - %td.right [number of posts in this layer] + %td.right= @layer_posts %td %td %td