12

I am having a problem getting an old Ruby on Rails 2 app that hasn't worked in a year to work.

I'm trying to run rake test:functionals in the root of my project directory, but am getting undefined method 'name' for "SystemTimer":String.

I've pasted everything that I believe relevant to the problem here: http://pastebin.com/NgBvystZ

Also, when I run rake itself, I get Errors running test:units! Not sure how to debug that.

I have copied and pasted everything that I think would be useful to understanding this problem. Your time is greatly appreciated. Thank you.

Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
sneilan
  • 1,367
  • 1
  • 10
  • 15

2 Answers2

54

This is an incompatibility between versions of RubyGems greater than 1.3.7 and versions of Rails less than 2.3.12. There are a few ways to solve this.

  1. Use Bundler

    Bundler is easy to install, fixes this problem, and has a number of other advantages as well. I highly recommend it.

  2. Upgrade to Rails 2.3.12 or higher

    Rails 2.3.12 fixed compatibility issues with RubyGems 1.8.5 (see release report).

  3. Downgrade to RubyGems 1.3.7

    I would not recommended this unless you have no other choice. Use this command: gem update --system 1.3.7. Also, version 1.7.2 has partial compatibility (it will run, but freezing gems will fail and there are likely other issues).

Ben Lee
  • 52,489
  • 13
  • 125
  • 145
  • 2
    You're right. This was the solution. I had to find the right packages to use with ruby since the RoR developers are not fans of backwards compatibility in any sense of the word. I managed to find an old list of packages with the version numbers and that saved me. – sneilan Jun 17 '11 at 18:53
  • 1
    Adding Bundler to a Rails 2 project is very easy and solves this problem. If you are not using rvm and have multiple sites on the same server do this: `bundle install --path vendor/bundle` to get an isolated copy of your gems. – Kris Jan 16 '12 at 19:54
  • Tried a bunch of different solutions but your first suggestion worked perfectly for me using RVM. I used two commands: `gem install rubygems-update -v 1.7.2` and then `update_rubygems --version=1.7.2` – Emerson Nov 22 '12 at 05:24
4

I chanced upon this thread, because I got the following error when migrating some Radiant 0.9.1 installations to a new server:

undefined method `name' for "RedCloth":String

(3) The compromising solution: I haven't tested this personally, but I hear that rails 2.3 with bundler is compatible with the latest rubygems. If you're interested in this solution, see http://gembundler.com/rails23.html for getting bundler to work under rails 2.3.

For me solution 3 was the only option, since we had other apps needing the latest rubygems on the system. Just install bundler and follow thes steps on this page: http://gembundler.com/rails23.html

And put this in a file called "Gemfile" in the app root:

source :gemcutter
gem "radiant", "0.9.1"
gem "sanitize"
gem "fastercsv"
gem "rmagick"
gem "rack", "~> 1.1.0"
gem "rake", ">= 0.8.3"
gem "RedCloth", ">= 4.0.0"
gem "will_paginate", "~> 2.3.11"
gem "mysql"

This is just my example. Start with only the first 2 lines, run bundle update and reload the page to see what else you might be missing.

Thank you Ben!

cmyk
  • 41
  • 2