Ruby on rails Rails中未定义的路径错误
我见过许多类似的问题,但我仍然无法解决这个错误:Ruby on rails Rails中未定义的路径错误,ruby-on-rails,ruby-on-rails-4,Ruby On Rails,Ruby On Rails 4,我见过许多类似的问题,但我仍然无法解决这个错误: undefined local variable or method `import_home_path' for #<#<Class:0x007fdcf7810ca0>:0x007fdcf7813108> 以下是耙子路径: Prefix Verb URI Pattern Controller#Action import_home_index POST /home/
undefined local variable or method `import_home_path' for #<#<Class:0x007fdcf7810ca0>:0x007fdcf7813108>
以下是耙子路径:
Prefix Verb URI Pattern Controller#Action
import_home_index POST /home/import(.:format) home#import
home_index GET /home(.:format) home#index
POST /home(.:format) home#create
new_home GET /home/new(.:format) home#new
edit_home GET /home/:id/edit(.:format) home#edit
home GET /home/:id(.:format) home#show
PATCH /home/:id(.:format) home#update
PUT /home/:id(.:format) home#update
DELETE /home/:id(.:format) home#destroy
home_test GET /home/test(.:format) home#test
这是调用import\u home\u路径的show.html.erb
<%= form_tag import_home_path, multipart: true do %>
<%= file_field_tag :file %>
<%= submit_tag "Import CSV" %>
<% end %>
我只是想用这个做一个简单的测试。但是在命名帮助程序中遇到了麻烦。根据路径,您的路径将是导入主页\索引\路径
,而不是导入主页\路径
,因此命名帮助程序将是前缀\u路径
是吗?明白了。谢谢你的帮助。
<%= form_tag import_home_path, multipart: true do %>
<%= file_field_tag :file %>
<%= submit_tag "Import CSV" %>
<% end %>