I kept on getting:

/usr/bin/gem:14: undefined method `ruby_version' ...

on a debian machine whenever I tried using gem. I ended up commenting out a few lines, then installing the latest version of rubygems-update from here with:

gem install rubygems-update-1.3.1.gem

Looks like it worked, but not for the real problem I was trying to solve. This was to try and solve this problem:

ActionView::TemplateError (undefined method `[]'

Which was solved thanks to these pages:

Re: [SOVED] AJAX error: ActionView::TemplateError (undefined method `[]’..

and

undefined method for enumerable

The actual fix was to put:

unless '1.9'.respond_to?(:force_encoding)  String.class_eval do    begin      remove_method :chars    rescue NameError      # OK    end  end
end

at the beginning of config/environment.rb.