Stack level too deep (SystemStackError)


#1

I picked up a post on the RoR list and decided to see if it fixed my
stack level problem. It did so Iâ??m x-posting. Here is the original post,
in case anyone else is having this problem:

For clarification, the problem only occurs in an environment where Gem
Rails is present. The current code handles this improperly. So, we have
a stop-gap fix and it appears the real fix is due RSN.

#load this before doing ANYTHING freaky with the reloading.
begin
  require 'rails_version' # Rails 1.0, 1.1.0
rescue LoadError, Gem::Exception
  require 'rails/version' # renamed as of Rails 1.1.1
end

As I am running Rails 1.1.2, in order to get the correct rails version
file being loaded I need the first “require” above to fail, so that the
rescue kicks in and the second “require” loads the “rails/version.rb”
from vendor/rails/…

Unfortunately, in my case (on Dreamhost) the first require does not fail
as the Rails 1.0 gem is available.

If I change the above code to simply say:

require ‘rails/version’

then my app works just fine.