Sha256: bab80b0649871dfc919537a60e4a8a1451757bba62d5257cc5701f72a2299140

Contents?: true

Size: 619 Bytes

Versions: 2

Compression:

Stored size: 619 Bytes

Contents

# -*- encoding : utf-8 -*-
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

2 entries across 2 versions & 1 rubygems

Version Path
rademade_admin-0.0.3 app/controllers/rademade_admin/abstract_controller.rb
rademade_admin-0.0.2 app/controllers/rademade_admin/abstract_controller.rb