FIX: don't show 'About category' topics on the 404 page

This commit is contained in:
Neil Lalonde 2014-07-04 16:18:09 -04:00
parent fc20332c0f
commit 5bcfb6ee38
1 changed files with 3 additions and 2 deletions

View File

@ -339,8 +339,9 @@ class ApplicationController < ActionController::Base
end
def build_not_found_page(status=404, layout=false)
@top_viewed = Topic.top_viewed(10)
@recent = Topic.recent(10)
category_topic_ids = Category.pluck(:topic_id).compact
@top_viewed = Topic.where.not(id: category_topic_ids).top_viewed(10)
@recent = Topic.where.not(id: category_topic_ids).recent(10)
@slug = params[:slug].class == String ? params[:slug] : ''
@slug = (params[:id].class == String ? params[:id] : '') if @slug.blank?
@slug.gsub!('-',' ')