From c4bdb2f86a55abfaf9a5917e39a39712e7e00153 Mon Sep 17 00:00:00 2001 From: dougbradbury Date: Thu, 11 Jun 2015 08:45:29 -0500 Subject: tags and categories sort by newest first --- app/controllers/refinery/blog/categories_controller.rb | 2 +- app/controllers/refinery/blog/posts_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/refinery/blog/categories_controller.rb b/app/controllers/refinery/blog/categories_controller.rb index b5ab574..649bfe6 100644 --- a/app/controllers/refinery/blog/categories_controller.rb +++ b/app/controllers/refinery/blog/categories_controller.rb @@ -4,7 +4,7 @@ module Refinery def show @category = Refinery::Blog::Category.friendly.find(params[:id]) - @posts = @category.posts.live.includes(:comments, :categories).with_globalize.page(params[:page]) + @posts = @category.posts.live.newest_first.uniq.includes(:comments, :categories).with_globalize.page(params[:page]) end end diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb index 2e504f7..8a9490f 100644 --- a/app/controllers/refinery/blog/posts_controller.rb +++ b/app/controllers/refinery/blog/posts_controller.rb @@ -78,7 +78,7 @@ module Refinery def tagged @tag = ActsAsTaggableOn::Tag.find(params[:tag_id]) @tag_name = @tag.name - @posts = Post.live.tagged_with(@tag_name).page(params[:page]) + @posts = Post.live.newest_first.uniq.tagged_with(@tag_name).page(params[:page]) end private -- cgit v1.2.3