how can I filter a second before_action?, I have two controllers, and when I call the method A, a before_action executes a methodB, but before executing this second method I would like to execute a general methodC, but in this method I need to pass a parameter to know where is coming from, but if I use a second before_action this doesn't work, because "only" in before_action filters using the first method method (which is methodA), what can I do?
class FirstController < SecondController
before_action :methodB
def methodA
#some code
end
end
class SecondController < ApplicationController
before_action only: [:methodB] do
methodC('methodB')
end
def methodB
#some code new
end
end
class ApplicationController < ActionController::Base
def methodC(method)
#general method
end
end
This is the structure that I have:
question from:
https://stackoverflow.com/questions/65881109/filter-methods-in-before-action-after-of-another-before-action 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…