Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails中未定义的路径错误_Ruby On Rails_Ruby On Rails 4 - Fatal编程技术网

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 %>