Tag: fof

fofof was useless

It’s always hard to kill your own code, but not killing it when you have to is worst in the long run. My idea for fof and consequently my gem fofof was useless.

First I’ve discovered it didn’t work at all with the new Rails 3 query syntax. When I started to find a fix I’ve discovered I could replace the whole thing with:

 || raise(NotFound.new)

The examples in the Find or 404 post would end up like:

Blog.find_by_id(id) || raise(NotFound.new)

and

blog = Blog.fof.find(blog_id)
post = blog.posts.find_by_id(id) || raise(NotFound.new)

It’s less code, it’s more robust, I even think it’s much more readable. So there you, I’m killing fofof.

Advertisements