Merge pull request #3956 from tgxworld/fix_clashing_slug

FIX: Clashing category slug.
This commit is contained in:
Guo Xiang Tan
2016-01-18 10:15:13 +08:00
10 changed files with 65 additions and 14 deletions

View File

@@ -49,9 +49,8 @@ module PrettyText
end
def category_hashtag_lookup(category_slug)
if category_slug
category = Category.find_by_slug(category_slug)
return ['category', category.url_with_id] if category
if category = Category.query_from_hashtag_slug(category_slug)
['category', category.url_with_id]
else
nil
end