diff --git a/app/models/concerns/category_hashtag.rb b/app/models/concerns/category_hashtag.rb index fe97b0252..8f2d807fb 100644 --- a/app/models/concerns/category_hashtag.rb +++ b/app/models/concerns/category_hashtag.rb @@ -5,7 +5,7 @@ module CategoryHashtag class_methods do def query_from_hashtag_slug(category_slug) - parent_slug, child_slug = category_slug.split(":", 2) + parent_slug, child_slug = category_slug.split(SEPARATOR, 2) category = Category.where(slug: parent_slug, parent_category_id: nil) diff --git a/spec/components/concern/category_hashtag_spec.rb b/spec/components/concern/category_hashtag_spec.rb index 3fe10ba84..be60931f7 100644 --- a/spec/components/concern/category_hashtag_spec.rb +++ b/spec/components/concern/category_hashtag_spec.rb @@ -11,7 +11,7 @@ describe CategoryHashtag do end it "should return the right result for a parent and child category slug" do - expect(Category.query_from_hashtag_slug("#{parent_category.slug}:#{child_category.slug}")) + expect(Category.query_from_hashtag_slug("#{parent_category.slug}#{CategoryHashtag::SEPARATOR}#{child_category.slug}")) .to eq(child_category) end @@ -20,7 +20,7 @@ describe CategoryHashtag do end it "should return nil for incorrect parent and child category slug" do - expect(Category.query_from_hashtag_slug("random-slug:random-slug")).to eq(nil) + expect(Category.query_from_hashtag_slug("random-slug#{CategoryHashtag::SEPARATOR}random-slug")).to eq(nil) end end end