Tag: Middleware

Thumb_metal

Real World Uses of Rails Metal and Middleware

22 Sep 2009 at 1:33pm

There are times when Rails feels very heavy! Jason Seifer has joked for ages about how Rails can’t scale, and we all know that’s a fallacy, but there are times when you know a bit of code is simple and could be really lightweight but having it as part of a controller, having gone through the Rails routing process and all the filters would just slow it down.

At the end of 2008 Rail Metal was introduced and it came like a breath of fresh air. It simply works as a lightweight class dropped in to /app/metal/ that is given the opportunity to handle a request before the main Rails stack.

When I first started reading about Rails Metal/Middleware it seemed like a great idea, but it didn’t really offer anything with a real tangible benefit. Can it be used in real life, or is it a nice bit of icing – something fancy to show off to non-Rails/Rack developers?