Ruby

http://s.erious.ly

Rail Spikes

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...

Let a human test your app, not (just) unit tests

I’m a big believer in unit testing. We unit test our Rails apps extensively, and we’ve done so for years. On some projects, we do both unit testing and integration testing using Cucumber. I preach unit testing to everyone I can. I’d...

Building a Video Delivery Network in 48 hours

Last weekend, I participated in my first Rails Rumble. Rails Rumble is a 48-hour app building contest. We started from scratch Friday evening – you can have concepts and notes on paper, but no code or digital UI assets – and stopped Su......

ActiveRecord refererential integrity is broken. Let’s fix it!

ActiveRecord supports cascading deletes to preserve referential integrity: 1 2 3 class User has_many :posts, :dependent => :destroy end But you really only want cascading deletes about half the time. The other half, you wa...

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...