Skip to content

Instantly share code, notes, and snippets.

@nathanallen
Created September 2, 2016 18:51
Show Gist options
  • Select an option

  • Save nathanallen/4531c01e1e3e957a39051633c250b662 to your computer and use it in GitHub Desktop.

Select an option

Save nathanallen/4531c01e1e3e957a39051633c250b662 to your computer and use it in GitHub Desktop.
From b37f800edbdf913280799fd37346c0b75d3fd76d Mon Sep 17 00:00:00 2001
From: nathanallen <thenathanator@gmail.com>
Date: Fri, 2 Sep 2016 11:49:11 -0700
Subject: [PATCH] fix count user posts
---
app/controllers/admin/dashboard_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb
index 32ea1f5..4f5eeb2 100644
--- a/app/controllers/admin/dashboard_controller.rb
+++ b/app/controllers/admin/dashboard_controller.rb
@@ -17,7 +17,7 @@ class Admin::DashboardController < Admin::BaseController
@statsdrafts = Article.drafts.where('created_at > ?', today).count
@statspages = Page.where('published_at > ?', today).count
@statuses = Note.where('published_at > ?', today).count
- @statuserposts = Article.published.where('published_at > ?', today).count(conditions: { user_id: current_user.id })
+ @statuserposts = current_user.articles.published.where('published_at > ?', today).count
@statcomments = Comment.where('created_at > ?', today).count
@presumedspam = Comment.presumed_spam.where('created_at > ?', today).count
@confirmed = Comment.ham.where('created_at > ?', today).count
--
2.5.4 (Apple Git-61)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment