Sha256: d4c868ce9c7c4fbd2874a2f629f4e7dd09ad293f7689e602f4be4ac37d403383
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
# -*- encoding : utf-8 -*- module RademadeAdmin class AbstractController < ApplicationController include ::RademadeAdmin::UriHelper include ::RademadeAdmin::Breadcrumbs layout 'rademade_admin' before_action :init_user, :init_template_service, :require_login, :root_breadcrumbs rescue_from ::CanCan::AccessDenied do |exception| redirect_to root_url, :alert => exception.message end protected def require_login redirect_to :controller => 'dashboard', :action => 'login' unless admin_logged_in? end def init_user @current_user = RademadeAdmin.user_class.find(session[:user_id]) if session[:user_id].present? end def init_template_service @template_service = RademadeAdmin::TemplateService.new('rademade_admin') end def render_errors(errors) render :json => { :errors => errors, :message => 'Error occurred' }, :status => :unprocessable_entity end def admin_logged_in? @current_user.is_a? RademadeAdmin.user_class and @current_user.admin? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rademade_admin-0.1.1 | app/controllers/rademade_admin/abstract_controller.rb |
rademade_admin-0.1.0 | app/controllers/rademade_admin/abstract_controller.rb |