From 22de2edae76ae7c3d7173f1b6b09e0b6db9f234c Mon Sep 17 00:00:00 2001
From: Robin Ward <robin.ward@gmail.com>
Date: Wed, 13 Aug 2014 15:24:28 -0400
Subject: [PATCH] FIX: Allow a search for a parent slug when a child exists
 with the same name.

---
 app/models/category.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/models/category.rb b/app/models/category.rb
index be7443ffe..c0cf16eb6 100644
--- a/app/models/category.rb
+++ b/app/models/category.rb
@@ -309,7 +309,7 @@ SQL
   end
 
   def self.query_parent_category(parent_slug)
-    self.where(slug: parent_slug).pluck(:id).first ||
+    self.where(slug: parent_slug, parent_category_id: nil).pluck(:id).first ||
     self.where(id: parent_slug.to_i).pluck(:id).first
   end