I have an authentication method in my ApplicationController that I always want to run first. I also have a method in the subcontroller that I want to run after the authentication method, but before another ApplicationController before_actions. In other words, I want this:
ApplicationController
before_action first
before_action third
OtherController < ApplicationController
before_action second
The above methods are called in the order: first→ third→ second. But I want the order to be as follows: first→ second→ third.
I tried using prepend_before_action, for example:
ApplicationController
prepend_before_action first
before_action third
OtherController < ApplicationController
prepend_before_action second
But it makes him go second→ first→ third.
How to get order first→ second→ third?