Q:

How to determine the caller of a before_action

I have a before_action that is called for user authentication and other features. But there is some functionality in the before_action that depends on the caller.
I don't want to separate the logic into two before_actions and use a skip_before_action; as large parts of the before_action must be executed in any case.
How can I determine the calling controller and method of the before_action?

A:

Do you think that a caller of a before_action is that action? This is not so. But, perhaps, you do need to find the caller. In this case, use caller. It'll return you a stack trace, which you can filter as you wish.
To find the action, use params[:action].

