Two Random Rails Notes

Tuesday, November 27, 2007, at 07:43PM

By Eric Richardson

I spent a chunk of the evening getting up to speed on how you're actually supposed to deploy Rails applications, figuring that my method of manually starting a server on some arbitrary point and pointing Apache at it probably wasn't recommended.

For both this site and blogdowntown I've set up mongrel clusters behind a pound balancer, roughly following instructions here and here. I don't currently have the mongrel clusters running out of init, but I think that should be the last step to getting things happy.

I'm been messing around with ambition, a plugin for writing database queries via Ruby. It's not that I think SQL is anything hard, it's just that there's a certain appeal in a query like:

live = Post::STATUS_LIVE
@aposts = Post.select { |p|
    p.status == live && p.users.id == @author.id
}.sort_by { |p| -p.timestamp }.first(3)

So far I'm just using it in a few places on the periphery of the blogdowntown code, but I'm intrigued.