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

View File

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