Skip to content

Instantly share code, notes, and snippets.

@shuhei
Created September 1, 2014 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shuhei/2d93e0ae6fc810a4a567 to your computer and use it in GitHub Desktop.
Save shuhei/2d93e0ae6fc810a4a567 to your computer and use it in GitHub Desktop.
Collect Rails middlewares
# 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