Created
September 1, 2014 02:57
-
-
Save shuhei/2d93e0ae6fc810a4a567 to your computer and use it in GitHub Desktop.
Collect Rails middlewares
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Paste this to Rails console. | |
def get_inner(app, middlewares) | |
middlewares << app.to_s | |
if inner = app.instance_variable_get(:@app) | |
get_inner(inner, middlewares) | |
end | |
end | |
def collect_middlewares(app) | |
result = [] | |
get_inner(app, result) | |
result | |
end | |
collect_middlewares(Rails.application.app) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment