debugging stack level too deep error on rails
Ran into a stack level too deep error while running rake db:seed on a client rails application I am upgrading from rails 3.2.
There wasn't much of a stack trace any where to help figure out the root cause of this problem, making my thoughts to be exactly what Captain Picard is saying here:
Steps for tracing a SystemStackError when there is no stack trace
- Create a trace.rb file with the following content, and place it in the ./config/initializers folder in the Ruby on Rails app:
- Perform the action that is causing the stack level too deep error message.
- The full stack trace will be dumped in the trace.txt file in the root directory of the Rails app.
- Look through the file, and profit.
In this specific case, it turned out that the associated model for the seed file that was causing the error was defining a named_scope with name :all. This is a problem when upgrading from Rails 3.x to Rails 4.x because Rails 4.x defines the all scope by default.