Module: ActiveScaffold::CancanBridge::ModelUserAccess::Controller

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_scaffold/bridges/cancan/lib/cancan_bridge.rb

Instance Method Summary collapse

Instance Method Details

#assign_current_ability_to_modelsObject

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.



47
48
49
# File 'lib/active_scaffold/bridges/cancan/lib/cancan_bridge.rb', line 47

def assign_current_ability_to_models
  ::ActiveRecord::Base.current_ability_proc = proc {send(:current_ability)}
end