Ruby

http://s.erious.ly

Author Archive

My weekend project: When’s your next "fun" birthday?

When’s the next time your birthday is going to be on a Friday or Saturday, so you can go out and have fun? That’s what my little weekend project will tell you. This site came about because my wife and I figured out that the...

Using acts_as_archive instead of soft delete

For the application I am working on right now, the ability to restore content that has been deleted is one of the requirements. A lot of people would just go ahead and add acts_as_paranoid or is_paranoid and be done with it, but I've...

Bundler and I are breaking up

Bundler may be the future, but after way too many hours of trying to get my app working with Rails 2.3.5, bundler 0.9.x, and Heroku I have decided to throw in the towel and switch back to Heroku’s gem manifest system. I had Bundler...

Rake task for deploying to Heroku

Deploying to Heroku is pretty easy, but I’ve often found myself needing to do additional tasks after pushing to Heroku’s git repository. For example, if you have to migrate, you have to do that after pushing; and after migrating you ha...

Fixing raw HTML error pages from Facebooker

I am using Facebooker for Facebook Connect with Rails 2.3.5 with the rails_xss plugin, which escapes HTML by default unless you use raw. I recently started seeing exceptions that looked like this: The top of the HTML contains a &...

Fixing the Heroku "Too many authentication failures for git" problem

Getting an error like this when you push to Heroku? electricsheep:herokuapp look$ git push heroku master Received disconnect from 75.101.163.44: 2: Too many authentication failures for git fatal: The remote end hung up unexpectedly If ...

Editing Migrations

I have a confession to make: when I’m starting out a new project, especially if it’s a small team, I like to edit my migrations. At the beginning of a project there are always a ton of changes in how models are defined and...

Y Combinator Interview Advice

Paul Graham emailed YC co-founders to share their interview stories for those who were asked to interview for the W10 batch. Here’s my take. First off, congratulations! You’re probably wondering what to do next, depending on the outco...

Weird Gem Error

Talk about a hard problem to diagnose! I canceled the installation of Rack 1.0 half way through because I realized I was running the wrong command (I didn’t use sudo like I wanted to). After that, I couldn’t load rack at all, eve...

validates_length_of byte counting gotcha

Watch out for validates_length_of if you need to make sure a string is a certain number of bytes long. For example, SMS messages can be no longer than 160 bytes in length. I recently got bit by this because some unicode “curly” quotes...

FutureRuby!

Jon and I will be at FutureRuby this weekend (actually, I will be there, and Jon will be speaking). Say “hi” if you see us. I’m flying into Toronto Thursday for FAILcamp.

Testing HTTP Authentication

If you ever need to test HTTP Authentication in your functional tests, here is how you do it: 1 2 3 4 5 6 def test_http_auth @request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(&quo...