Tag: custom error pages

Ruby on Rails 3.2.13 – 使用I18n获取自定义错误页面的错误

我有一个Rails 3.2.13应用程序,我最初使用路由filtergem为I18n。 我计划在Rails 4中重写它。我删除了gem,因为没有可用的Rails 4生产版本​​,我无法让beta版本工作。 我成功地为大多数应用程序设置了路由。 我唯一的问题是我的自定义错误页面。 我在使用routing-filter gem时创建了自定义错误页面。 我需要有关如何为自定义错误页面设置路由的帮助。 以下是我在config / application.rb中进行配置的方法 config.exceptions_app = self.routes 这是我在application_controller.rb中的内容 before_filter :set_locale def default_url_options(options={}) { :locale => I18n.locale } end private def set_locale I18n.locale = (params[:locale] if params[:locale].present?) || cookies[:locale] || ‘en’ cookies[:locale] = I18n.locale if cookies[:locale] != I18n.locale.to_s end 这是我在使用路由filtergem时在路由文件中的内容。 match “/404”, to: ‘errors#error_404’ match “/500”, to: […]