Module: FourEyes::ControllerAdditions::ClassMethods
- Defined in:
- lib/four_eyes/controller_additions.rb
Instance Method Summary collapse
-
#add_maker_checker_to_resource(*args) ⇒ Object
Sets up a before filter which adds maker checker functionality to the controller.
- #four_eyes_resource_class ⇒ Object
Instance Method Details
#add_maker_checker_to_resource(*args) ⇒ Object
Sets up a before filter which adds maker checker functionality to the controller
To exempt any one of the actions
class StudentsController < ApplicationController
add_maker_checker_to_resource, except: :delete
end
To include only a subset of the actions
class StudentsController < ApplicationController
add_maker_checker_to_resource, only: [:create, :update]
end
29 30 31 32 33 34 35 36 |
# File 'lib/four_eyes/controller_additions.rb', line 29 def add_maker_checker_to_resource(*args) # Add maker functions four_eyes_resource_class.add_maker_create_function(self, :maker_create, *args) four_eyes_resource_class.add_maker_update_function(self, :maker_update, *args) four_eyes_resource_class.add_maker_delete_function(self, :maker_delete, *args) four_eyes_resource_class.add_maker_generic_function(self, :maker_generic, *args) end |
#four_eyes_resource_class ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/four_eyes/controller_additions.rb', line 38 def four_eyes_resource_class if ancestors.map(&:to_s).include? "InheritedResources::Actions" InheritedResource else ControllerResource end end |