Module: ActiveScaffold::Bridges::Cancan::ModelUserAccess::Controller

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_scaffold/bridges/cancan/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.



68
69
70
# File 'lib/active_scaffold/bridges/cancan/cancan_bridge.rb', line 68

def assign_current_ability_to_models
  ::ActiveScaffold::Registry.current_ability_proc = proc { send(:current_ability) }
end