From f691ad87516043aaf7a5f1f55f82d4c1713be7a4 Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 28 Oct 2013 18:44:21 -0700 Subject: fixed numerous bugs relating to localization --- app/controllers/application_controller.rb | 3 ++- app/controllers/pages_controller.rb | 3 +++ app/views/errors/error.html.haml | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a9a25f0..ee53415 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -47,7 +47,8 @@ class ApplicationController < ActionController::Base ## RENDERING ## - def render_500 + def render_500(msg=nil) + @message = msg render :template => 'errors/error', :status => 500 end diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 3e76092..933aed7 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -5,6 +5,9 @@ class PagesController < ApplicationController layout :choose_layout rescue_from ActionView::MissingTemplate, :with => :render_404 rescue_from PageNotFound, :with => :render_404 + rescue_from Encoding::CompatibilityError do |exception| + render_500(exception.to_s) + end def show @page = site.find_pages(params[:page]) diff --git a/app/views/errors/error.html.haml b/app/views/errors/error.html.haml index 7f16eb5..45948ef 100644 --- a/app/views/errors/error.html.haml +++ b/app/views/errors/error.html.haml @@ -1,3 +1,6 @@ .dialog %h1 - We're sorry, but something went wrong. \ No newline at end of file + We're sorry, but something went wrong. + %blockquote + - if @message + = h @message \ No newline at end of file -- cgit v1.2.3