I suggest taking a look at the source code and API Docs on filters.
The default ordering should be
:set_post
:set_user
I think if you wanted to push :set_user
to the top of the stack you could change the line in A
to
prepend_before_action :set_user
Also worth pointing out, this isn't the only question on the topic; there are others here on SO.
As for your specific situation, it looks like you'll need to change A
as I mentioned above in order to have @user
be assigned by the time set_post
in B
runs.
As of 4.2.6 (probably changed in an earlier version), the ordering is now parent before child:
:set_user
:set_post
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…