Sha256: 819f6a9229e74b2334220b257df9235b79b69e02205534a18d812258ef568ea9

Contents?: true

Size: 610 Bytes

Versions: 2

Compression:

Stored size: 610 Bytes

Contents

module Cream::Generators 
  module Config
    module CanCan  
      def cancan_configure
        configure_cancan_gems 
        cancan_exception_handling
      end
      
      def cancan_gems
        gem 'cancan'  
        gem 'cancan-rest-links'
      end

      # CanCan access denied exception handling
      def cancan_exception_handling
        insert_into_controller :application, :after => "ActionController::Base\n" do
          %{
  rescue_from CanCan::AccessDenied do |exception|
    flash[:error] = exception.message
    redirect_to root_url
  end
  }
        end
      end      
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cream-0.6.4 lib/generators/cream/config/modules/cancan_config.rb
cream-0.6.3 lib/generators/cream/config/modules/cancan_config.rb