Some of my application's controllers are a blend of modules from other people's Rubygems, such as ShopifyApp library. They inject before and after action filters around my actions. Sometimes they abort the request and redirect somewhere else. I wanted to know what filters were being invoked and in what order:
class ProductsController < AuthenticatedController
def index
__callbacks[:process_action].map { |c| [c.kind, c.instance_variable_get(:"@key")] }
end
end
The output was like:
[
[:around, 82000],
[:before, :set_shop_host],
[:before, :redirect_to_splash_page],
[:before, :set_locale],
[:after, :set_test_cookie],
[:before, :verify_authenticity_token],
[:after, :verify_same_origin_request],
[:after, :set_esdk_headers],
[:before, :login_again_if_different_user_or_shop],
[:around, :activate_shopify_session],
[:before, :set_shop_origin]
]
Top comments (0)