瀏覽代碼

Count posts per layer in the view not the controller

master
Adrian Short 11 年之前
父節點
當前提交
08a790c89e
共有 2 個檔案被更改,包括 2 行新增4 行删除
  1. +0
    -3
      app/controllers/layers_controller.rb
  2. +2
    -1
      app/views/layers/show.html.haml

+ 0
- 3
app/controllers/layers_controller.rb 查看文件

@@ -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 查看文件

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


Loading…
取消
儲存