RailsCasts Pro episodes are now free!
Learn more or hide this
Great idea and well presented as usual Ryan...
Title was a little misleading though :/
I am trying to avoid renaming the titles of the episodes when I revise them, so I understand that can make it a little misleading.
Understood - would be good to see more on Metal though :)
Particularly, the common pitfalls when trying to include behaviour that may be strewn across two or three ActionController modules
We'd probably see a more significant improvement in performance if your action wasn't shelling out. eg. if you just ran some ruby code or returned the contents of a file instead of starting a sub-shell to get the process list.
Thanks for the screencast!
If we add a few middle on the top of the stack and gain performance for those items, will it slow down the rest of the app because the middleware stack is now deeper?
It depends on what you're doing in the middleware, but usually it will only add a quick "if" condition and a couple method calls to the stack. In theory it is slightly slower but nothing that will be noticeably slower.
ActionController::Metal is basically a stripped down rendition of ActionController::Base. It's chiefly utilized for API's on account of it does exclude modules that regularly accompany a Rails controller, in this way enhancing execution.
To get this working in Rails 5, I had to turn off Turbolinks. Checkout the source code on how to get this working in Rails 5.