Module: Caprese::Callbacks::ClassMethods
- Defined in:
- lib/caprese/controller/concerns/callbacks.rb
Instance Method Summary collapse
-
#inherited(subclass) ⇒ Object
Is called when any controller class inherits from a parent controller, copying to the child controller all of the callbacks that have been stored in instance variables on the parent.
Instance Method Details
#inherited(subclass) ⇒ Object
Is called when any controller class inherits from a parent controller, copying to the child controller all of the callbacks that have been stored in instance variables on the parent
64 65 66 67 68 69 |
# File 'lib/caprese/controller/concerns/callbacks.rb', line 64 def inherited(subclass) CALLBACKS.each do |method_name| instance_variable_name = "@#{method_name}_callbacks" subclass.instance_variable_set(instance_variable_name, instance_variable_get(instance_variable_name)) end end |