简体   繁体   中英

Rails 3.1 Stack level too deep

Ironically i would like some feed back on a Stack level too deep error!

I've been looking through my code for hours and can't figure out what's wrong! It occurs when I try to load a javascript-file that is located in the welcome folder, and this is how the code looks like this:

application.html.erb:

<!DOCTYPE html>
<html>
<head>
  <title>Project1</title>
  <%= stylesheet_link_tag "application" %>
  <%= javascript_include_tag "application" %>
  <%= csrf_meta_tags %>

</head>
<body>

<%= yield %>
</body>
</html>

index.html.erb:

<!DOCTYPE html>
<div id="wrapper">
  <div id="header" >
    <div id="Lorem">
      <b>Lorem
    </div>
    <div id="Ipsum">
      <b><p>Ipsum</p>
    </div>
  </div>
  <div id="menuwrapper">
    <div class="tabArea">
      <%= link_to 'Link', {:action => 'update', :controller => 'welcome'},{:class=>"tab",:remote=>true} %>
    </div>
  </div>
  <div id="wrapper2">
  </div>
</div>

welcome_controller.rb:

#coding:utf-8
class WelcomeController < ApplicationController  
  def index

  end
  def update
    respond_to do |format| format.js { render :update => update} end
  end
end

update.js.erb:

$(alert("Hello"));

routes.rb:

  get "welcome/index"
  get "welcome/update"

Eternally grateful for any ideas of whats causing the overflow! Thanks you.

/Peter

Backtrace: http://i.imgur.com/b503D.png

Per comments earlier,

Rails is being told to render the update action when rendering for JS format on the update action. The offending code is:

{render :update => update}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM