我对昨天将代码推送到生产后收到的新错误感到难过。我没有编辑文件中的任何内容,它仍可在我的本地计算机上正常工作。这段代码已经好几个月了。任何见解都将不胜感激。
日志错误:
23:20:49.403 2014-10-01 03:20:49.235167+00:00 app web.1 - - /app/app/views/line_items/_new_product_form.html.erb:38: warning: else without rescue is useless
» 23:20:49.403 2014-10-01 03:20:49.235974+00:00 app web.1 - - Rendered line_items/index.html.erb within layouts/application (16.0ms)
» 23:20:49.403 2014-10-01 03:20:49.239762+00:00 app web.1 - -
» 23:20:49.403 2014-10-01 03:20:49.239765+00:00 app web.1 - - ActionView::Template::Error (/app/app/views/line_items/_new_product_form.html.erb:2: syntax error, unexpected keyword_do, expecting keyword_end
» 23:20:49.403 2014-10-01 03:20:49.239767+00:00 app web.1 - - ..., @line_item]), remote: true do |f| @output_buffer.safe_appe...
» 23:20:49.403 2014-10-01 03:20:49.239769+00:00 app web.1 - - ... ^
» 23:20:49.403 2014-10-01 03:20:49.239771+00:00 app web.1 - - /app/app/views/line_items/_new_product_form.html.erb:38: syntax error, unexpected keyword_do, expecting keyword_end
» 23:20:49.403 2014-10-01 03:20:49.239772+00:00 app web.1 - - ..., @line_item]), remote: true do |f| @output_buffer.safe_appe...
» 23:20:49.403 2014-10-01 03:20:49.239773+00:00 app web.1 - - ... ^
» 23:20:49.403 2014-10-01 03:20:49.239775+00:00 app web.1 - - /app/app/views/line_items/_new_product_form.html.erb:60: syntax error, unexpected keyword_end, expecting end-of-input
» 23:20:49.403 2014-10-01 03:20:49.239777+00:00 app web.1 - - end ;@output_buffer.to_s
» 23:20:49.403 2014-10-01 03:20:49.239778+00:00 app web.1 - - ^):
» 23:20:49.403 2014-10-01 03:20:49.239780+00:00 app web.1 - - 1: <% if params[:request_id] || params[:order_id] %>
» 23:20:49.403 2014-10-01 03:20:49.239781+00:00 app web.1 - - 2: <%= simple_form_for ([type, @line_item]), remote: true do |f| %>
» 23:20:49.403 2014-10-01 03:20:49.239783+00:00 app web.1 - - 3: <%= f.error_notification %>
» 23:20:49.403 2014-10-01 03:20:49.239784+00:00 app web.1 - - 4: <div class="form-inputs">
并且相应的视图(这是部分和&#34;类型&#34;被传入)。
<% if params[:request_id] || params[:order_id] %>
<%= simple_form_for ([type, @line_item]), remote: true do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :product, :label => "Product Needed", :required => true, :autofocus => true %>
<%= f.input :quantity, :required => true, :input_html => { min: 0, max: 10000 }, as: :integer %>
<%= f.input :unit, label: "Unit Measurement (leave blank if 'each')", collection: LineItem::UNITS.map { |s| [s.humanize.downcase, s]} %>
<%= f.input :comments, :required => false, as: :text, :placeholder => "Any additional information you would like to provide." %>
</div>
<div class="form-actions">
<%= f.button :submit, "Add Product to List", class: "btn btn-success btn-block", data: {disable_with: "Adding..."} %>
</div>
<% end %>
<% else %>
<%= simple_form_for ([type, @line_item]), remote: true do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :product, :label => "Product Needed", :required => true, :autofocus => true %>
<%= f.input :quantity, :required => true, :input_html => { min: 0, max: 10000 }, as: :integer %>
<%= f.input :unit, label: "Unit of Measurement (leave blank if 'each')", collection: LineItem::UNITS.map { |s| [s.humanize.downcase, s]} %>
<%= f.input :comments, :required => false, as: :text, :placeholder => "Any additional information you would like to provide." %>
</div>
<div class="form-actions">
<%= f.button :submit, "Add Product to List", class: "btn btn-success btn-block", data: {disable_with: "Adding..."} %>
</div>
<% end %>
<% end %>
答案 0 :(得分:0)
“没有救援的其他东西是没用的”,因为“如果你有一个畸形”,那就是红宝石。在这种情况下,看起来就像是在调用simple_form_for时,在错误的地方有parens。我之前没有使用过simple_form_for,但这就是错误。或完全离开parens。
<%= simple_form_for ([type, @line_item], remote: true) do |f| %>