Rails中的number_field_tag正在创建一个循环

时间:2013-10-24 01:41:23

标签: ruby-on-rails model-view-controller ruby-on-rails-4 erb partial

感谢您允许我来这里。我搜索并搜索了这个谜语的答案。 我正在尝试我的第一个Rails应用程序,一切都很简单:索引页面召唤_calc.html.erb部分。并召唤它,召唤它...... ETA固定!代码低于 - >对于未来遇到错误的人,突出显示违规行:

<%= form_for :plan do %>
    <em>OK, how much do you make?</em>
    <%= number_field_tag :salary %>
    <% puts "The salary field is producing the loop" %>
<h3><span id="more">Continue</span></h3>

<script type="text/javascript">
$("#more").click(function(){
    $("div.subcalculator").animate({opacity: 1},800);
});
$("#moremore").click(function(){
    **<% if check_expenses(:salary, :weeklyExpenses) %>**
    $("div.sub_subcalculator").animate({opacity: 1},800);
    **<% end %>**
});
</script>
<div id="subcalculator" class="subcalculator">

ETA错误:现在出现在localhost:3000的屏幕是

We're sorry, but something went wrong.

If you are the application owner check the logs for more information.

在Rails服务器中它说:

  

为127.0.0.1启动GET“/”   at 2013-11-03 11:30:37 -0500
由IntroController处理#index   作为HTML
工资字段正在产生循环
工资   字段正在产生循环
工资字段正在产生   循环
工资字段正在产生循环
工资字段   正在生成loopRendered计划/ _calc.html.erb(1.3ms)
  渲染计划/ _calc.html.erb(2.2ms)
已呈现   plan / _calc.html.erb(3.1ms)
已提交计划/ _calc.html.erb   (4.0ms)
渲染计划/ _calc.html.erb(4.8ms)
已呈现   plan / _calc.html.erb(5.6ms)
已提交计划/ _calc.html.erb   (6.5ms)
渲染计划/ _calc.html.erb(7.4ms)
已呈现   plan / _calc.html.erb(8.2ms)
已提交计划/ _calc.html.erb   (9.1ms)

我确定循环发生在部分的顶部;第一个助手是number_field_tag,它似乎反复渲染但后续的number_field_tag(s)没有。
如果我做了很小的修改,我倾向于强制性地耙路线和迁移,所以如果这有帮助的话:

root        GET    /                         intro#index
intro_index GET    /intro/index(.:format)    welcome#index
 plan_index GET    /plan(.:format)           plan#index
            POST   /plan(.:format)           plan#create
   new_plan GET    /plan/plan/calc(.:format) plan#new
  edit_plan GET    /plan/:id/edit(.:format)  plan#edit
       plan GET    /plan/:id(.:format)       plan#show
            PATCH  /plan/:id(.:format)       plan#update
            PUT    /plan/:id(.:format)       plan#update
            DELETE /plan/:id(.:format)       plan#destroy


0 个答案:

没有答案