FIX: Allow a search for a parent slug when a child exists with the same

name.
This commit is contained in:
Robin Ward 2014-08-13 15:24:28 -04:00
parent 7ed969f0c7
commit 22de2edae7

View File

@ -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