Handle /t/only-the-slug urls by trying to find the topic by slug (second try)

This commit is contained in:
Neil Lalonde
2013-06-06 14:41:27 -04:00
parent f268b882fd
commit 62041da7e0
3 changed files with 24 additions and 14 deletions

View File

@ -282,6 +282,7 @@ class ApplicationController < ActionController::Base
@latest = f.order('views desc').take(10)
@recent = f.order('created_at desc').take(10)
@slug = params[:slug].class == String ? params[:slug] : ''
@slug = (params[:id].class == String ? params[:id] : '') if @slug.blank?
@slug.gsub!('-',' ')
render status: status, layout: 'no_js', template: '/exceptions/not_found'
end