Ruby on Rails 2.3.4 not playing well with Ruby 1.9.1

6 September 2009 by Bret

I was hoping upgrading from Rails 2.3.3 to 2.3.4 was going to be a breeze. Nope. Apparently, there are some issues with Rails 2.3.4 and Ruby 1.9.1 as detailed in this lighthouse ticket.

The problem is in the active_support-2.3.4/lib/active_support/message_verifier.rb file. When you try and login to your Rails app you’ll receive an error like:
undefined method `^' for "9":String

I won’t get into the details as to what’s breaking, that’s for those much smarter than I.

Basically if you’re using Ruby 1.9.1, you might be better off not upgrading to 2.3.4 as your application will break. I applied the patch in the ticket and all works now, but what a pain. Seems like something that should have been tested before 2.3.4 was released. Others have had the same issue as well.

To apply the patch I downloaded the patch from the lighthouse ticket above to my desktop and then used:
cd /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4
sudo patch -p1 < /local/path/to/patch/0001-ruby-1.9-friendly-secure_compare.patch

The file that needed to be patched couldn't be found so i got:
File to patch:
Where I entered the path to the file:
lib/active_support/message_verifier.rb

The patch then applied and I was once again able to login to my application.

Bookmark and Share

Tags: , ,

This entry was posted on Sunday, September 6th, 2009 at 3:41 pm and is filed under Updates. You can follow any responses to this entry through the RSS feed. Both comments and pings are currently closed.

2 Responses to “Ruby on Rails 2.3.4 not playing well with Ruby 1.9.1”

  1. Grant Sayer says:

    This patch works – FINALLY . I chose a more manual method by looking at the code that was on the page

    https://rails.lighthouseapp.com/projects/8994/tickets/3144/a/261015/0001-ruby-1.9-friendly-secure_compare.patch

    And then edited the file. Bit of a brute-force method.

  2. [...] 1.9.1 may be the future, right now more like bleeding edge. If you’ve been bit by a broken Rails 2.3.4 upgrade, try patching or checkout stable-2.3 instead. Also, what to do with Rack 1.0 and file [...]