Class: Tuttle::CancancanController

Inherits:
ApplicationController show all
Defined in:
app/controllers/tuttle/cancancan_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
10
11
# File 'app/controllers/tuttle/cancancan_controller.rb', line 7

def index
  @cancan_user = current_user || User.new
  @ability = Ability.new(@cancan_user)
  @rules = @ability.instance_variable_get('@rules')
end

#rule_testerObject



13
14
15
16
17
18
19
# File 'app/controllers/tuttle/cancancan_controller.rb', line 13

def rule_tester
  @models = ActiveRecord::Base.descendants.reject(&:abstract_class)
  @action = params[:action_name] || 'read'
  @subject = find_subject(params[:subject_class], params[:subject_id])
  @cancan_user = current_user || User.new
  @ability = Ability.new(@cancan_user)
end