Sha256: 048c91d27d7e92a1f77d9cb10bec28b7fb084bdded5c304fcb41f13adac3a6c8
Contents?: true
Size: 996 Bytes
Versions: 14
Compression:
Stored size: 996 Bytes
Contents
module Ecrire ## # The class any controller in a theme needs to inherit from # # +ThemeController+ provides boilerplate code so the blog handles a few cases # for you. # # Ecrire will try to redirect to the homepage when it meets selected exceptions # Currently, the following 3 exceptions are handled: # - ActiveRecord::RecordNotFound # - ActionController::RoutingError # - ActionView::ActionViewError # class ThemeController < ::ApplicationController unless Rails.env.development? rescue_from ActiveRecord::RecordNotFound, with: :redirect_home rescue_from ActionController::RoutingError, with: :redirect_home rescue_from ActionView::ActionViewError, with: :redirect_home end before_action :pagination, only: :index private def pagination params[:per] ||= 10 params[:page] ||= 1 end def redirect_home(exception) flash[:errors] = t('errors.request.not_found') redirect_to '/' end end end
Version data entries
14 entries across 14 versions & 1 rubygems