Don't call to_sym on param

This commit is contained in:
Mark Rushakoff 2013-03-28 20:50:07 -07:00
parent cb6b9ccc6d
commit 3e3712a517
1 changed files with 4 additions and 1 deletions

View File

@ -4,7 +4,7 @@ class EducationController < ApplicationController
def show
raise Discourse::InvalidAccess.new unless params[:id] =~ /^[a-z0-9\-\_]+$/
raise Discourse::NotFound.new unless I18n.t(:education).include?(params[:id].to_sym)
raise Discourse::NotFound.new if I18n.t("education.#{params[:id]}", default: MISSING_KEY) == MISSING_KEY
education_posts_text = I18n.t('education.until_posts', count: SiteSetting.educate_until_posts)
@ -14,4 +14,7 @@ class EducationController < ApplicationController
render text: PrettyText.cook(markdown_content)
end
private
MISSING_KEY = '_MISSING_KEY_'.freeze
end