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:

    [sourcecode language='ruby']
    undefined method empty?' for /_generator$/:Regexp
    [/sourcecode]

    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

    [sourcecode language='ruby']
    sudo gem update --system
    [/sourcecode]

    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:

    [sourcecode language='ruby']
    sudo gem install rubygems-update
    sudo update_rubygems
    [/sourcecode]

    You can check your current RubyGems version with

    [sourcecode language='ruby']
    gem -v
    [/sourcecode]
    If it reports 1.3.0 or later, you should be good to use the recent Rails releases.