Shiva Bhusal
Shiva's Blog

Follow

Shiva's Blog

Follow

SystemStackError: stack level too deep

Shiva Bhusal's photo
Shiva Bhusal
·Aug 14, 2019·

1 min read

Play this article

Background

Today I encountered with the following error. I didn't know what might be the cause of this error.

Expected Culprit

SystemStackError in DashboardsController#show
stack level too deep

Extracted source (around line #11):

    else
      > @questions = current_organization.questions.in_dashboard
        @subjects  = current_organization.subjects.in_dashboard
    end
  end

Rails.root: /Users/john/projects/lgprofile

Application Trace | Framework Trace | Full Trace
app/controllers/dashboards_controller.rb:11:in `show'

The code in line no#11 looks fine to me. It was n't changed in a few days. This should not be the cause. I then checked the associations. May be something changed and is causing this error. I found no changes in the model association code.

While going through the git diff I saw some new line in model like

Real Culprit

  +  scope :parents, -> { where(question_id: nil) }
  +

When I commented this code, the app started running again.

Reason behind this error

 
Share this