This commit is contained in:
Toks
2013-04-13 13:42:23 -04:00
parent 5843b3037f
commit c9e98a4619
2 changed files with 11 additions and 4 deletions

View File

@@ -202,8 +202,12 @@ class PostQueryBuilder
has_constraints!
end
if q[:parent_id]
relation = relation.where("(posts.id = ? or posts.parent_id = ?)", q[:parent_id], q[:parent_id])
if q[:parent] == "none"
relation = relation.where("posts.parent_id IS NULL")
elsif q[:parent_neg] == "none" || q[:parent] == "any"
relation = relation.where("posts.parent_id IS NOT NULL")
elsif q[:parent]
relation = relation.where("(posts.id = ? or posts.parent_id = ?)", q[:parent], q[:parent])
has_constraints!
end