Rails does an awful lot to optimize page generation, but there are a number of hacks, tweaks, and usage patterns you should be using to get the most out of your app. Configuration tweaks There’s a lot of the Rails stack that’s written in Ruby, which is great – it’s portable, it’s flexible, it works [...]
Monthly Archives: December 2009
When you have to store user passwords…
Today we got word of yet-another-database-hack-with-plaintext-passwords. This time, it’s RockYou, purveyor of many of those Facebook and Myspace apps you use. Oops. Every time this comes up, everyone says “How naive! They should have been using salted hashed passwords!” This is true in any case where you don’t need to use the password again on [...]
Multibyte string slicing for fun and profit
Ran into a small issue in one of my user models. I was using a helper to display a user’s first name, last initial. It looked something like this: def display_name(user) "user.first_name #{user.last_name.slice(0,1)}" end Seems innocent enough, sure. Except…it doesn’t work in multibyte character sets. The first Cyrillic speaker to sign up blew that all [...]
System date considered important
I’ve been slamming my head against the wall for the past two hours. I had an OAuth connection to a remote service working just dandy in development, but as soon as I tried to use that exact same code with the exact same config and exact same gems in production…I was getting “401 unauthorized” errors [...]