How to get memprof (within rails) to track all the before filters and then the action before it dumps the output?
Based on the Memprof gem docs, in order to get the Memprof::Middleware working with rails we need wrap each request within Memprof.trac开发者_高级运维k.
The question is: How do I do this in such a way that memprof tracks all the before filters and then the action before it dumps the output?
without knowing anything about Memprof nor knowing much about what you're trying to accomplish, here's my best guess.
in your application_controller.rb:
before_filter :do_memprof_stuff
def do_memprof_stuff
# make it really sweet
end
that'll do memprof stuff before any before filters that are defined in other controllers are called. You could obviously move that into an engine pretty easily so you could include it in any project, but I'll leave the as an exercise to the OP since I'm not sure if I'm even answering his question :)
精彩评论