2012-11-09 112 views
0

我想用主動管理上傳CSV文件,我想知道這是可能的,創建一個from_tag的f.input裏面:路由錯誤,導入CSV

<%= f.inputs do%> 
    <%= f.input :contact, :as => :select, :collection => Contact.all %> 
    <%= f.input :route_import, :as => :select, :collection => RouteImporter.all %> 
    <% form_tag({:action => :upload}, :multipart => true) do %> 
     <%= file_field_tag 'upload_data'%> 
    <% end %> 
<%end%> 

當我運行但我得到這個錯誤:

Routing Error No route matches {:action=>"upload", :controller=>"admin/routes"}

我想調用的方法上傳這是RouteQuickcom類,我在做什麼錯謝謝!

回答

0

快速注意,這不會解決你的路由問題:

把一個form到另一個form是無效的HTML,並從我的經驗,瀏覽器不知道如何處理這並最終提交主表格,但顯然有一些解決方法,如果你真的想這樣做: Is it valid to have a html form inside another html form?