I have a code that inherits Devise::InvitationController, and the controller seems to inherits ApplicationController too.
It was magic. I wanted to understand why. so I read the code.
$ bundle open devise_invitable $ bundle open devise
class Devise::InvitationsController < DeviseController
class DeviseController < Devise.parent_controller.constantize
# The parent controller all Devise controllers inherits from. # Defaults to ApplicationController. This should be set early # in the initialization process and should be set to a string. mattr_accessor :parent_controller @@parent_controller = "ApplicationController"
mattr_accessor is similar with
attr_accessor. It automatically makes a get/set method for the module.
Devise.parent_controller become "ApplicationController". Of course, you can customize it.
The reference of mattr_accessor.
This programming gives you power.
(open source and trusted by devs everywhere ❤️)