Browse Source

Count posts per layer in the view not the controller

master
Adrian Short 11 years ago
parent
commit
08a790c89e
2 changed files with 2 additions and 4 deletions
  1. +0
    -3
      app/controllers/layers_controller.rb
  2. +2
    -1
      app/views/layers/show.html.haml

+ 0
- 3
app/controllers/layers_controller.rb View File

@@ -19,9 +19,6 @@ class LayersController < ApplicationController
@feed = Feed.new @feed = Feed.new
@feed.new_layer_id = @layer.id @feed.new_layer_id = @layer.id


@layer_posts = 0
@layer.feeds.each { |f| @layer_posts += f.posts.size }

respond_to do |format| respond_to do |format|
format.html # show.html.erb format.html # show.html.erb
format.json { render json: @layer } format.json { render json: @layer }


+ 2
- 1
app/views/layers/show.html.haml View File

@@ -24,8 +24,9 @@
%th %th
%th %th
%th %th
- @layer_posts = 0
- @layer.feeds.each do |f| - @layer.feeds.each do |f|
- @layer_posts += f.posts.count
%tr %tr
%td %td
.feed_title .feed_title


Loading…
Cancel
Save