Class: Tuttle::CancancanController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#check_reload_status

Instance Method Details

#indexObject



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

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

#rule_testerObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/tuttle/cancancan_controller.rb', line 11

def rule_tester
  @action = params[:action_name] || 'read'
  subject_class = params[:subject_class]
  subject_id = params[:subject_id]
  if subject_class
    begin
      subject_klass = subject_class.constantize
      @subject = subject_klass.find(subject_id) unless subject_id.blank?
      @subject ||= subject_klass.new
    rescue
      # Could not load subject
    end
  end
  @cancan_user = current_user || User.new
  @ability = Ability.new(@cancan_user)
end