Reputation: 5
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: https://i.sstatic.net/92kve.png
Upvotes: 1
Views: 596
Reputation: 2413
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}
Upvotes: 3