Please read for an updated status on RailsCasts:
Learn more or hide this
GitHub User: jni-
First comment on railscasts, so here is the mandatory (and more than deserved) nicety : great job with this site!
Just a quick comment though that kept bugging me while watching this episode, since I'm a nitpicker. I don't like when the "else" is far from the "if", especially if the "if" is somewhat long. You could invert the condition here to make it easier to read. However, I also try to avoid 2-branches conditions when I can bail early. For example here, the first line could be "return @app.call(env) unless env["PATH_INFO"] == /batch", and you can then proceed with the rest of the function without the condition. General rule : when the first line of a method is an "if" and the last one closes that if you can always 1- avoid the 2 branches, 2 - both "branches" should be methods, if they are not simple one liners.
I guess there are many ways to refactor this, but that's the one I usually use :P To me it reads "proceed as normal, unless the path is /batch in which case, go on"
Sorry for the nitpicking on a very interesting episode