Updating to Rails 3.1 (rc5)

With a slight lull in the course of events (despite a martial arts test upcoming) I turned my attention back to Siggnal. I missed the Rails 3.1 bug mash, so I figured I’d take a swing at converting it. There’s always version control. I found that there is still good reason for it be pre-release. I realized after I got into it that I should have taken better notes, so this description will be missing precise error messages and such.

The first step was to get gems on the latest (hopefully 3.1 ready) release, and then update rails itself to the latest point release. That all went smoothly.

Gemfile

Then, since the standard gemfile supplies a precise version number I had to figure out what to install. As of Tuesday it was 3.1.0.rc5. In the process of looking that up I found example rails 3.1 gemfiles, which included jquery-rails and the asset block.

group :assets do
  gem 'sass-rails', "~> 3.1.0.rc"
  gem 'coffee-rails', "~> 3.1.0.rc"
  gem 'uglifier'
end

During the process, I also started looking for Heroku-specific advice, since that is where I’m deploying, and the asset pipeline seemed like it might be especially problematic. In fact it must on the new cedar stack, so I had another adventure ahead of me – since cedar is more general, heroku can’t magically do as many things for you. I did discover an updated bundler require line.

Bundler.require *Rails.groups(:assets) if defined?(Bundler)

Active Admin

I’ve been enjoying Active Admin for several of my projects. However, it’s a big project with a lot of dependencies and code, so it’s got a pretty big exposure for version changes like this. In fact it was quite broken, and I believe even stopping the app from staring up. The first tip I found was to use a pre-release version of meta_search. In the end however, getting it running also required pulling a copy straight out of github, which had the 3.1 branch merged in and further development besides

gem 'meta_search', '>= 1.1.0.pre'
gem 'activeadmin', :git => 'git://github.com/JustinLove/active_admin.git'

Everything Else

Further complicating matters, I’ve been variously working on three or four rails projects lately, so I finally understood the use case for Pow. But it was another moving part, and wasn’t playing nice at first. I found a discussion that pointed at RVM. Updating (and compiling the latest of patch release of Ruby for good measure) seemed to resolve that issue.

The next error was ‘debug_rjs’ This turned out be a defunct config parameter – one of the dangers of upgrading an app versus starting from scratch.

Heroku

Finally I started chewing on the Heroku issues. Installing blew up with an error on fastercsv. This one really baffled me since it was complaining about the same version I was using locally. Searching around eventually pointed the finger at a bundler bug triggered by gitting active_admin. The work around is to explicitly name the problem dependencies.

group :bundlerbug do
  gem 'fastercsv'
  gem 'kaminari'
end

The next thing to bedevil me was an error that only appeared when visiting through the now-updated http://siggnal.net It immediately blew up, and all the logs had to say was ArgumentError (dump format error (user class)): After searching for a bit I got the hint that it was a cookie issue. Clearing cookies worked, but I wondered how I might handle a situation with more users. I made several attempts to catch the error, but finally had to conclude that the error was coming from deep in the bowls of Rack, before my app even started running, so there was no place to catch an exception. I gave up and cleared all the cookies. What someone with a major site would do, I have no idea – it crashes before the app runs, so you’d almost have to wrap it with some other program to clear the cookies first. Use a hacked Rack perhaps?

I haven’t attempted any scientific experiments to determine if the cookie-invalidation was due to the rails update, the heroku stack update, or just changing heroku apps.

So far I’ve just got Siggnal running on 3.1, I haven’t had a chance to play with any of the new toys yet.

Posted Thursday, August 11th, 2011 under Devlog.

Comments are closed.