It was Rails and, it wasn't that it wasn't unscalable but because they did it wrong then, they hired a bunch of developers that knew nothing about Rails, so of course they moved a lot of new and core development to other technologies.
It also had a lot to do with the fact that at the time Rails sites mostly ran on lighttpd or Mongrel, which was notoriously crashy (god was originally invented just to restart crashed Mongrels). From what I understand, at the time ActiveRecord hadn't yet been rewritten in C, which was also a big bottleneck for them (not to mention trying to scale MySQL to an insane level of traffic).
Nowadays, we have fancy stuff like Resque for background jobs, Passenger (aka mod_rails) for serving up Rails content, and a plethora of NoSQL databases.
ActiveRecord was never rewritten in C. Twitter's problems stemmed from the fact that they had written a realtime messaging system, but designed it like a microblogging platform. The design wouldn't have scaled well, regardless of the technology they used.