Class: Tuttle::CancancanController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Tuttle::CancancanController
- Defined in:
- app/controllers/tuttle/cancancan_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#index ⇒ Object
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_tester ⇒ Object
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 |