0

ここに私を許可してくれてありがとう。私はこのなぞなぞの答えを探して探しました。私は最初の Rails アプリを試していますが、すべてが簡単です: インデックス ページは_calc.html.erbパーシャルを呼び出します。そしてそれを召喚し、召喚する...
ETA FIXED!以下のコード -> 問題のある行は、将来エラーが発生する人のために強調表示されます。

<%= 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 ERROR: localhost:3000 で表示される画面は

We're sorry, but something went wrong.

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


そしてRails Serverでは次のように書かれています:

Started GET "/" for 127.0.0.1 at 2013-11-03 11:30:37 -0500
IntroController#index による HTML として
の処理 給与フィールドがループを生成しています 給与フィールド
がループを生成しています
給与フィールドがループを生成しています
給与フィールドはループを生成しています
給与フィールドはループを生成していますRendered plan/_calc.html.erb (1.3ms) Rendered plan
/_calc.html.erb (2.2ms)
Rendered plan/_calc.html.erb (3.1ms)
Rendered plan/_calc.html.erb (4.0ms)
レンダリングされた plan/_calc.html.erb (4.8ms)
レンダリングされた plan/_calc.html.erb (5.6ms)
レンダリングされた plan/_calc.html.erb (6.5ms)
レンダリングされた plan/ _calc.html.erb (7.4ms)
レンダリングされたプラン/_calc.html.erb (8.2ms)
レンダリングされた計画/_calc.html.erb (9.1ms)

パーシャルの上部でループが発生することを確認しました。最初のヘルパーは a 用で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


4

0 に答える 0