Sfoglia il codice sorgente

Count posts per layer in the view not the controller

master
Adrian Short 11 anni fa
parent
commit
08a790c89e
2 ha cambiato i file con 2 aggiunte e 4 eliminazioni
  1. +0
    -3
      app/controllers/layers_controller.rb
  2. +2
    -1
      app/views/layers/show.html.haml

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

@@ -19,9 +19,6 @@ 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 }


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

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


Caricamento…
Annulla
Salva