# Config.gem causes stack level too deep?

**URL:** <https://www.ruby-forum.com/t/config-gem-causes-stack-level-too-deep/187689>\
**Category:** Rails\
**Created:** [April 27, 2010, 8:27pm UTC](https://www.ruby-forum.com/t/config-gem-causes-stack-level-too-deep/187689 "2010-04-27T20:27:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![clavatinc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f05b48/32.png) [@clavatinc](https://www.ruby-forum.com/u/clavatinc)\
**Post date:** [April 27, 2010, 8:27pm UTC](https://www.ruby-forum.com/t/config-gem-causes-stack-level-too-deep/187689/1 "2010-04-27T20:27:53Z")

</div>

I’m trying to figure out why config.gem seems to cause problems.

I have installed two gems ‘will\_paginate’ and ‘searchlogic’ that need to  
be declared in the environment.rb file in order to be useful. I  
installed ‘will\_paginate’ first.  
After putting the config.gem ‘will\_paginate’ command in my  
environment.rb, i rebooted mongrel only to get:

=\> Booting Mongrel  
=\> Rails 2.3.5 application starting on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem\_dependency.rb:119:in  
`requirement': stack level too deep (SystemStackError) from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:in `requirement’  
from C:/Ruby/lib/ruby/site\_ruby/1.8/rubygems.rb:210:in `activate' from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:1056:in `gem’  
from  
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem\_dependency.rb:73:in  
`add_load_paths' from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:301:in `add\_gem\_load\_paths’  
from  
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:301:in  
`each' from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:301:in `add\_gem\_load\_paths’  
from  
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:132:in  
`process' ... 10 levels... from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’  
from ./script/server:3  
from -e:2:in `load’  
from -e:2

I removed the config line and it went away. Of course, this wasn’t good  
enough since I wanted the will\_paginate functionality. Finally i  
discovered if I replaced the config.gem command with a require  
‘will\_paginate’ line at the end of the file I could avoid the error spam  
and still get my functionality.

Here is the text of my environment.rb file without comments:

############  
require File.join(File.dirname( **FILE** ), ‘boot’)

Rails::Initializer.run do |config|

config.action\_controller.session = {  
:session\_key =\> ‘\_history\_session’,  
:secret =\>  
‘13093336cef6ac2aeeca0681504f5b7d24d398d333fd5c1563772a7cc9b648ba9222109406d91c49e5cfeb03266feab44634326c5a4d8fcb7658360f7b4b0f80’  
}

config.gem ‘searchlogic’  
config.gem ‘will\_paginate’

end  
########
