Sha256: 12529e80847ef272f678fc9b7efe1e3f1cca4f76732fab46644b2ebcece157dd

Contents?: true

Size: 813 Bytes

Versions: 5

Compression:

Stored size: 813 Bytes

Contents

module Cms
  module Fortress
    module ApplicationControllerMethods
      def after_sign_in_path_for(resource)
        admin_cms_path
      end

      def after_sign_out_path_for(resource_or_scope)
        # request.referrer
        admin_cms_path
      end

      def ability_class
        if defined?(Ability)  #File.exist?(File.join(Rails.root, "app", "models", "ability.rb"))
          Ability
        else
          CmsAbility
        end
      end

      def current_ability
         @current_ability ||= ability_class.new(current_cms_fortress_user)
      end

      def self.included(base)
        base.class_eval do

          rescue_from CanCan::AccessDenied do |ex|
            redirect_to cms_fortress_unauthorised_path #, :alert => ex.message
          end

        end
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cms-fortress-1.1.1 lib/cms/fortress/application_controller_methods.rb
cms-fortress-1.1.0 lib/cms/fortress/application_controller_methods.rb
cms-fortress-1.0.12 lib/cms/fortress/application_controller_methods.rb
cms-fortress-1.0.9 lib/cms/fortress/application_controller_methods.rb
cms-fortress-1.0.8 lib/cms/fortress/application_controller_methods.rb