Sunday, November 23, 2008

Rails 2.1.2 and 2.2: Update Your RubyGems

There’s a mismatch between the most recent Rails releases (2.1.2 and 2.2RC1) and older versions of RubyGems. Judging by what I’ve seen in various discussion fora, this is well on the way to being a FAQ. It’s made more fun by the facts that

  • The error message doesn’t implicate RubyGems
  • You may think you’re up-to-date on RubyGems when you’re not
  • If you’re affected, you’ll see this message when you try to run script/generate in a Rails application:
    undefined method empty?' for /_generator$/:Regexp

    If you see this, don’t panic. It just means you need a newer RubyGems release. I’m not sure how current you need to be, but 1.1.1 is definitely too old. As I write this, 1.3.0 is current.

    Now, in theory, to update to the latest version of RubyGems, you just need to run
    sudo gem update --system

    But - depending on what version of RubyGems you have installed, running that command may lie and tell you that you have nothing to update. If you’re currently on RubyGems 1.1 or 1.2, you need to run a different set of commands to update RubyGems:
    sudo gem install rubygems-update
    sudo update_rubygems

    You can check your current RubyGems version with
    gem -v

    If it reports 1.3.0 or later, you should be good to use the recent Rails releases.

    1 comment:

    Anonymous said...

    Who knows where to download XRumer 5.0 Palladium?
    Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!