我很难过这个。我只是在生产中遇到这个问题,开发工作正常,ajax调用成功。在生产中,调用是以JSON形式进行的,但我收到了模板错误。
生产环境:
Ubuntu 14.04
Passenger Nginx
AJAX致电:
$.ajax
url: url
type: 'PATCH'
data: purchasing_cost_item: { description: description, total: total}
dataType: "json"
控制器响应阻止:
respond_to do |format|
format.json { render json: @purchasing_cost_total, status: 200 }
end
生产日志:
INFO -- : Started PATCH "/properties/1/purchasing_cost_items/2"
INFO -- : Processing by PurchasingCostItemsController#update as JSON
INFO -- : Parameters: {"purchasing_cost_item"=>{"description"=>"Test description", "total"=>"1690"}, "property_id"=>"1", "id"=>"2"}
INFO -- : Completed 500 Internal Server Error in 11ms
FATAL -- : ActionView::MissingTemplate (Missing template purchasing_cost_items/update, application/update with {:locale=>[:en], :formats=>[:json, :js, :html, :text, :js, :css, :ics, :csv, :png, :jpeg, :gif,
:bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}.