From 56fb6fb14119e4ba6ad2e63dba48315e22c17ca5 Mon Sep 17 00:00:00 2001 From: petopeto Date: Thu, 26 Aug 2010 21:17:48 +0000 Subject: [PATCH] temporary helper: allow pool_posts:master and pool_posts:slave --HG-- branch : moe extra : convert_revision : svn%3A2d28d66d-8d94-df11-8c86-00306ef368cb/trunk/moe%4034 --- app/models/post/sql_methods.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/models/post/sql_methods.rb b/app/models/post/sql_methods.rb index 07addf83..c93506dc 100644 --- a/app/models/post/sql_methods.rb +++ b/app/models/post/sql_methods.rb @@ -139,8 +139,14 @@ module PostSqlMethods end if q.has_key?(:pool) - if q.has_key?(:pool_posts) && q[:pool_posts] == "all" - conds << "(pools_posts.active OR pools_posts.master_id IS NOT NULL)" + if q.has_key?(:pool_posts) + if q[:pool_posts] == "all" + conds << "(pools_posts.active OR pools_posts.master_id IS NOT NULL)" + elsif q[:pool_posts] == "master" + conds << "(pools_posts.master_id IS NOT NULL)" + elsif q[:pool_posts] == "slave" + conds << "(pools_posts.active AND pools_posts.slave_id IS NOT NULL)" + end elsif q.has_key?(:pool_posts) && q[:pool_posts] == "orig" conds << "pools_posts.active = true" else