Class: CanCan::ControllerResource
- Inherits:
-
Object
- Object
- CanCan::ControllerResource
- Defined in:
- lib/extend_ccc.rb
Instance Method Summary collapse
-
#load_resource_callback ⇒ Object
扩展的处理加载资源的回调方法调用.
-
#load_resource_with_handle ⇒ Object
cancan加载资源后,对该资源进行相关的处理,由扩展的ActionController::Base#after_loaded_cancan_resource设置.
Instance Method Details
#load_resource_callback ⇒ Object
扩展的处理加载资源的回调方法调用
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/extend_ccc.rb', line 40 def load_resource_callback @controller.cancan_resources << self.resource_instance @controller.class.loaded_cancan_resources.each do |processor| if processor.is_a?(Proc) @controller.instance_eval { processor.call(self.resource_instance) } else @controller.send(processor, self.resource_instance) end end end |
#load_resource_with_handle ⇒ Object
cancan加载资源后,对该资源进行相关的处理,由扩展的ActionController::Base#after_loaded_cancan_resource设置
32 33 34 35 36 |
# File 'lib/extend_ccc.rb', line 32 def load_resource_with_handle current_ability load_resource_without_handle load_resource_callback if self.resource_instance end |