Yikes! stack level too deep

I'm not able to get past this... Basically I'm displaying my "Participant" and wish to display participant details which includes several partials. I've studied this over and over and I cannot fathom how an infinite loop can come from showing an object and its sub- objects. Feel like I'm getting nuts here. Are there other reasons we can get this error "stack level too deep"?

Showing participants/show.html.erb where line #63 raised:

stack level too deep

63: <%= render :partial=>'messages/list', :locals => { :pid => nil, :@messages => @participant.messages, @participant=> @participant } %>

Then if I fiddle with the file, is continues to error out on line 63, regardless of what it is:

    Showing participants/show.html.erb where line #63 raised:

     stack level too deep

     Extracted source (around line #63):

     60: <hr>      61: <p>      62: <b>Sponsors count:</b>      63: <%=h @participant.sponsors_count %>      64: </p>      65: <%= render :partial => "sponsors/list", :locals => { :sponsors => @participant.sponsors, :pid => @participant.id}%>      66: <hr>

Until I comment out so many lines that there are none for it to complain about

    Showing participants/show.html.erb where line #63 raised:

     stack level too deep

     Extracted source (around line #63):

     <nothing here>

Then I reboot webrick. Then it works fine for one hit to 'http:// localhost:3001/participants/show", but not any subsequent refreshes. Perhaps its my IDE? Radrails 1.2.7.024747

I'm not able to get past this... Basically I'm displaying my "Participant" and wish to display participant details which includes several partials. I've studied this over and over and I cannot fathom how an infinite loop can come from showing an object and its sub- objects. Feel like I'm getting nuts here. Are there other reasons we can get this error "stack level too deep"?

Showing participants/show.html.erb where line #63 raised:

stack level too deep

63: <%= render :partial=>'messages/list', :locals => { :pid => nil, :@messages => @participant.messages, @participant=> @participant } %>

This use of locals looks a bit weird, but i don't think it is the problem

Then I reboot webrick. Then it works fine for one hit to 'http:// localhost:3001/participants/show", but not any subsequent refreshes. Perhaps its my IDE? Radrails 1.2.7.024747

Unlikely. Stuff that works for one request only usually indicates that the code that reloads your source in between requests has got confused. One way of doing this is using require to require classes from your app: either don't use require (let rails load things magically) or use require_dependency as that keeps rails in the loop about what you are doing

Fred

To add to Fred's note, you don't need to pass a controller class level variable (@participant) as a local variable to a second partial in the same request cycle as it is already visible.