The hubby (a longtime PHP developer and fellow Rails n00b) is super-excited about the recent release of the Rails 3.1 beta because it has support built in for things like Sass (a.k.a. SCSS) and CoffeeScript. These things are nifty, although besides Sass, I’m only vaguely aware of most of the things he lists off. I agree, the new version of Rails will be fun. Where we differ is how much fun trying to use it in beta is.
I’m used to how things work in Rails 3.0. I didn’t have any real issues with how it worked, because I don’t do enough scripting (read: almost none) to care about CoffeeScript, and I was content getting the hang of regular CSS before branching out into Sass. My projects weren’t of a scope where I needed those features. So switching to 3.1 for a project the hubby wants to work on with me was more a favor for him, and I thought it would be an opportunity to get used to some of the features a little earlier.
I forgot, or perhaps didn’t really know, how difficult bugs can be to track down in a beta, especially when I make plenty of new and exciting mistakes on my own at this point that I have to diagnose. And there are some fun ones to make when moving a project from one version to another!
Then the hubby found out that in 3.1, password encryption is a built-in feature (which is an AWESOME change), so I rolled back two migrations in which I had implemented my own password encryption. Then I spent a while looking at the one blog post everyone linked to on the topic and trying to figure out what the heck they meant by “Your model will need a field called password_digest”. Where was I supposed to add that, and how? Well, it turns out that means you need to add a column to your database table with a migration:
class AddPasswordDigest < ActiveRecord::Migration
add_column :users, :password_digest, :string
remove_column :users, :password_digest
And then run “rake db:migrate”.
So I did that, and then I wanted to annotate my models to see if the changes had gone as I expected, at which point I ran into a whole new problem: I couldn’t run the command “annotate”. So I tried to add it to my Gemfile. It was already there, it seemed, but I tried moving it into a different group. I tried different annotation gems. I tried destroying my Gemfile.lock and re-running “bundle install”. Nothing worked. I thought the beta had broken something badly. I finally gave up on Google to answer the question and was writing up a question on stackoverflow.com when the hubby looked over at my screen and asked what was going on. With his greater experience in debugging, he found out that the problem was that I hadn’t quit my text editor between when I deleted my first attempt at the project and when I created a new attempt of the same name. Basically, the version of the Gemfile I’d been editing was the version in the trash. D’oh! But come on, how un-intuitive is that?
And now, annotate is STILL broken! It shows up as being installed now, but it still gives errors when I try to run it. It hasn’t been updated since November 2009, so it may just be broken with the new version of Rails. Ick.
Also busted in the beta: autotest. This makes me very, very sad. Having constant reporting on whether my tests pass is really nice, and would have been extra-nice now, when a bunch of stuff is broken and I’m going to have to rewrite at least half of my tests. At least running “rspec spec” still runs my tests, but doing it manually after each of my adjustments is going to be a pain in the butt. Update: Autotest actually works fine, I just broke it in my upgrade process. Details in my next post.