0
任何人都可以解釋這個錯誤嗎?嘗試在ERB文件中分割和減去。我相信最好的做法是在控制器中做,但寧可不行。ActionView :: Template :: Error(THING不能被強制轉換爲Fixnum):
ActionView::Template::Error (AcctLedger can't be coerced into Fixnum):
Mar 09 00:25:34 myapp app/web.2: 107:
Mar 09 00:25:34 myapp app/web.2: 108: <% if "myapp XL" == call.requested_type %>
Mar 09 00:25:34 myapp app/web.2: 109: <% if call.has_fee? %>
Mar 09 00:25:34 myapp app/web.2: 110: <% price = (price - call.has_fee)/2 %>
Mar 09 00:25:34 myapp app/web.2: 111: <% else %>
Mar 09 00:25:34 myapp app/web.2: 112: <% price = price/2 %>
Mar 09 00:25:34 myapp app/web.2: 113: <% end %>
什麼'call.has_fee'的價值?看起來像它的布爾值 –
您是否嘗試將其轉換爲整數befor進行計算,ruby中的.to_i方法。這是非常基本的,但這是我唯一的想法 –