module ActiveScaffold::Bridges::Cancan::ModelUserAccess::Controller

Public Instance Methods

assign_current_ability_to_models() click to toggle source

We need to give the ActiveRecord classes a handle to the current ability. We don’t want to just pass the object, because the object may change (someone may log in or out). So we give ActiveRecord a proc that ties to the current_ability_method on this ApplicationController.

# File lib/active_scaffold/bridges/cancan/cancan_bridge.rb, line 47
def assign_current_ability_to_models
  ::Sequel::Model.current_ability_proc = proc {send(:current_ability)}
end