我的一些路線出現此錯誤。
#ActionView::Base:0x0000000002ada0 的未定義區域變數或方法 `export_on_demand_dictionary_processor_path' 您是說什么?export_on_demand_dictionary_processor_index_path
如何在不向所有路由路徑添加“索引”的情況下修復此錯誤?
url 路徑發生錯誤。
$.ajax({
type: 'POST',
url: "<%= export_on_demand_dictionary_processor_path %>",
data: $('#export_params_input').val() '&' $.param({'build_request_id' : $("#build_request_id").val()}),
success: function(data, text_status, xhr) {
window.location.href = data["new_href"];
$("#load_build_section :input").attr("disabled", false);
$("#export_progress_message").hide();
},
error: function(xhr) {
$("#load_build_section :input").attr("disabled", true);
$("#export_progress_message").html("Export failed. (HTTP " xhr.status ")");
}
})
這就是我的 route.rb 的樣子。
resources :dictionary_processor, :as => :dictionary_processor, :only => [] do
collection {
get 'import';
get 'propose_on_demand';
post 'run_import';
get 'propose_build';
post 'export_on_demand';
}
uj5u.com熱心網友回復:
您可以更改resources為resource或。名稱中的單數和復數在 Rails 中很重要。dictionary_processordictionary_processors
請小心,因為控制器名稱將變為復數。在更改之前和之后,您可以使用命令檢查您的路線以查看更改的內容
rails routes
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/478522.html
