Do it to it.

“Do it to it” was a phrase that my high school computer science teacher would say after describing the next assignment he was giving the class.

The saying has following me throughout the years. Other than being a variation of Nike’s “Just Do it” motto, I’m not really sure why I still remember it other than it encompasses what really matters when being tasked with something.

Given two options of doing something myself or having someone else do it for me, I find myself often saying that I want to do it. I think it’s just that I want the experience and satisfaction (maybe I’m a control-freak). When it comes to work, I have always volunteered to try out new things or build the next big feature. That’s the fun stuff to work on. If there’s a really difficult problem or bug, although I am hating the bug when I’m trying to fix it, in retrospect I usually feel a sense of accomplishment and pride after fixing it.

I think that’s what a lot of programmers that have passion about code have in common. We really enjoy solving problems, using that brain of ours, and building new things with code. Between the late night deploys, emergency bug fixes, and ridiculous business requests, the challenge, the sense of ownership, and the art of building software makes it worthwhile and oh so enjoyable.

So, open up your favorite IDE and do it to it.

Do it to it.

Autocomplete in Rails 2.0

I’ve been trying out the newly released Rails 2.0. Lots of cool new stuff. However, it takes some time to get used to doing things the new way if you haven’t been working from EdgeRails.

One of the features that came out of the box in previous releases was support for autocomplete using scriptaculous. This has now been moved from the core rails install to an install via plugin.

Just install the plugin via:
script/plugin install http://svn.rubyonrails.org/rails/plugins/auto_complete

Then, you have to turn off the cross-site request forgery protection that comes with Rails 2.0.

You can do this at the Controller level by adding something similar to the following:

class UsersController < ApplicationController
protect_from_forgery :only => [:update, :delete, :create] // exclude the auto_complete method
...
end

If you don’t do this, your autocomplete actions will throw an ActionController::InvalidAuthenticityToken exception which caused me hours of confusion.

Autocomplete in Rails 2.0