module Caprese::Callbacks::ClassMethods

Public Instance Methods

inherited(subclass) click to toggle source

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

@param [Class] subclass the child class that is to inherit the callbacks

# 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