Sha256: 3022bf6346365267727814a1895d4c892a580fda8f4eeec423c75ef5f21b713e

Contents?: true

Size: 591 Bytes

Versions: 1

Compression:

Stored size: 591 Bytes

Contents

module RademadeAdmin
  class AbstractController < ApplicationController
    include ::RademadeAdmin::UriHelper

    layout 'rademade_admin'

    before_action :require_login

    rescue_from ::CanCan::AccessDenied do |exception|
      redirect_to root_url, :alert => exception.message
    end

    def require_login
      redirect_to :controller => 'dashboard', :action => 'login' unless user_signed_in?
    end

    def render_errors(errors)
      render :json => {
        :errors => errors,
        :message => 'Error occurred'
      }, :status => :unprocessable_entity
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rademade_admin-0.0.1 app/controllers/rademade_admin/abstract_controller.rb