Module: Canable::Enforcers

Defined in:
lib/canable/enforcers.rb

Overview

Module that holds all the enforce__permission methods for use in controllers.

Class Method Summary collapse

Class Method Details

.included(controller) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/canable/enforcers.rb', line 4

def self.included(controller)
  controller.class_eval do
    Canable.actions.each do |can, able|
      delegate      "can_#{can}?", :to => :current_user
      helper_method "can_#{can}?" if controller.respond_to?(:helper_method)
      hide_action   "can_#{can}?" if controller.respond_to?(:hide_action)
    end
  end
end