Porting from Ruby 1.8.7 to Ruby 1.9.3: An Oddyssey
Episode I
Late November afternoon, a yellow sun hangs over the glass buildings of Herzliya Pituach, and here at Kontera the Moon team has decided to finally face an ancient challenge and attempt to port one of our core services to Ruby 1.9.3.
Unlike Achilles at the gates of Troy, we had no heavenly assistence from the gods, except one - Google, the God of Knowledge.
Our journey started by installing Ruby 1.9.3 (preview), and creating a new gemset.
The first problem soon popped up, not much more intelligible than the riddle of the Sphynx.
It looked like this:
undefined method `path' for class `ActionController::UploadedStringIO
The problem it seems lay in the fact that we needed to use Ruby on Rails as a gem rather as a 3rd-party code.
We therefore deleted the Rails vendor folder:
rm -rf vendor/rails
Next we had to decide on a matching version of Ruby on Rails. Having first tried 2.3.8, we made up our minds to go with 2.3.14.
Removing unnecessary plugins was a high priority - we managed to delete all but four:
- acts_as_addressable
- acts_as_commentable
- acts_as_permissable
- auto_complete
The other plugins we replaced with gems.
Unfortunately, even these many offerings could not please the gods of Ruby, and not much later we encountered our next challenge.
Episode II
It soon came to our attention that 'CGI::Session::ActiveRecordStore' had been deprecated, giving us the following error
uninitialized constant CGI::Session:
The solution, it seemed, lay with simply changing "CGI::Session::ActiveRecordStore" to "ActiveRecord::SessionStore".
Just like a Harpy, right on the heels of this error arrived another one:
uninitialized constant ApplicationController
here the solution was as simple as before - renaming the file "application.rb" to "application_controller.rb"
So far so good, but the next issue proved to be quite a Chimera. A file called 'admin_access_helper.rb' is apparently needed by the app, and is nowhere to be found:
cannot load such file - admin_access_helper.rb
After searching all across the wide web and consulting every oracle we encountered, the mystery seemed to no closer to solution. Finally we decided to call it a day and go back to our tents to sleep.
The morning, however, brought a surprising turn of events - just like the Greek armies on the beaches of Troy, this problem dissappeared into thin air!
It completely vanished, leaving no trace behind except its tracks in our logfile.
Puzzled and even a bit concerned, we decided to continue on our way.
Episode III
Finally after many efforts we managed to set sail on the Rails and leave the sands behind us - the application was finally up and running on our localhost.
A long journey still lay ahead of us before reaching safety, however, and it was not long before dark clouds gathered overhead, in the form of an error message:
stylesheet_link_tag : wrong number of arguments (1 for 2)
The problem lay in a method called 'expand_stylesheet_sources', which now was hungry for two arguments instead of one (the second is a Boolean named 'recursive').
So a TRUE was added as a second argument, and we continued.
A third error now reared its ugly head:
sessions_controller.rb:86: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'
But seasoned code warriors by now, solving it was easy - simply removing the offending colon.
The sun started to set, and we decided to stop for the night on a small island and attempt to rest, before continuing on our journey.

Gil Erlich
Reader Comments (1)
nice post!
being at the cutting edge, well.. may involve some bleeding.