Hosting toy Rails and Django apps using Passenger

I like writing small self-contained applications, and I like writing then using nice high-level application frameworks like Django and Rails. Alas, I also like being able to run these services for the foreseeable future, and that’s a lot harder than writing them is. Running a single Rails or Django application consumes an appreciable chunk of […]

Irritating 2038 Ruby / Rails behaviour

In a rails console: >> (Time.now + 30.years).class => Time >> (Time.now + 31.years).class => DateTime >> (Time.now + 30.years).to_s => "Sat Oct 17 17:27:11 +0100 2037" >> (Time.now + 31.years).to_s => "2038-10-17T17:27:13+01:00" Time objects after about August 2028 can’t be expressed internally as ‘UNIX epoch (1st January 1970) plus N seconds’ where N is a […]

Getting ActiveRecord objects by ID

I’m trying to speed up a rails app here, and I’ve been making some assumptions that I’ve realised may not actually be true. Specifically, if I have a list of IDs, I’ve been assuming that list_of_ids.map{|id| Model.find(id) } is going to be slower than Model.find( list_of_ids ) Presumably, the latter will only make one SQL call to fetch […]