0
我的一個遠程操作出現了一些奇怪的問題。我想解析通過表單上傳的CSV文件。 CSV文件解析正確,大約需要20秒(可以,因爲CSV文件包含帶有下載鏈接的網址)。成功解析我的視圖後不顯示。有趣的是,該視圖呈現時,未在表單中選擇csv文件。ActionView :: MissingTemplate長Ajax請求後
#Products Controller:
def get_imported
p=Product.new
@tab = nil
@tab = p.import_csv(params[:product][:csv_file],params[:product][:source]) unless params[:product][:csv_file].nil?
end
#app/views/products/get_imported.js.coffee view:
$('#results').html '<br/><div class="alert alert-info">
<h4 class="alert-heading">Imported products:</h4>
<% if @tab.blank? %>
Error: No CSV file
<% else %>
<% for element in @tab %>
<%= @tab.name %><br/>
<% end %>
<% end %>
</div>'
如果我選擇csv文件,並提交我的表單顯示以下錯誤信息:
ActionView::MissingTemplate (Missing template products/get_imported, application/get_imported with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in:
* "/home/chmarus/Pulpit/test/app/views"
* "/home/chmarus/.rvm/gems/ruby-1.9.3-head/gems/twitter-bootstrap-rails-2.1.0/app/views"
* "/home/chmarus/.rvm/gems/ruby-1.9.3-head/gems/devise-2.1.2/app/views"
* "/home/chmarus/.rvm/gems/ruby-1.9.3-head/gems/ckeditor-3.7.1/app/views"
):
我不明白爲什麼導軌無法找到此模板。如果沒有選定文件,警報會正確呈現來自同一文件的文件。
感謝您的回覆。我不知道通過ajax上傳文件是如此有問題。我要去檢查https://github.com/leppert/remotipart – Arti 2012-07-15 13:44:08