Sha256: 34511f5b177de6a177ea9cd6a666681c028efcfa8a986748e347a7de614cc7b4
Contents?: true
Size: 1.13 KB
Versions: 7
Compression:
Stored size: 1.13 KB
Contents
require 'ostruct' module Faalis module Dashboard class ApplicationController < Faalis::ApplicationController include Faalis::Dashboard::DSL layout 'faalis/dashboard' before_action :authenticate_user! before_action :setup_sidebar before_action :setup_header rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized rescue_from ActiveRecord::RecordNotFound, with: :redirect_to_404 protected def setup_header @dashboard_section_title = t(controller_name.underscore) @dashboard_resource_name = t(controller_name.underscore.singularize) @dashboard_section_slug = t(action_name) end private def user_not_authorized flash[:alert] = t('faalis.not_authorized') redirect_to new_user_session_path end def redirect_to_404(e) logger.warn "Catch and ActiveRecord::RecordNotFoundL: '#{e}'" respond_to do |f| f.html { redirect_to faalis.dashboard_not_found_url } f.js { render 'faalis/dashboard/not_found' } end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems