From 293afd80ff68edbca593c9fbe8840e71e575c38b Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Sun, 11 Sep 2011 19:28:52 -0700 Subject: [PATCH] all_public scope in Post for clarity --- app/controllers/tags_controller.rb | 2 +- app/models/post.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index c66c874dc..9be96f559 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -57,7 +57,7 @@ class TagsController < ApplicationController ) )).select('DISTINCT posts.*') else - @posts = StatusMessage.where(:public => true, :pending => false) + @posts = StatusMessage.all_public end @posts = @posts.tagged_with(params[:name]) diff --git a/app/models/post.rb b/app/models/post.rb index b0e201314..6a04e685f 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -31,6 +31,8 @@ class Post < ActiveRecord::Base validates :guid, :uniqueness => true + scope :all_public, where(:public => true, :pending => false) + def diaspora_handle read_attribute(:diaspora_handle) || self.author.diaspora_handle end