I've got some weird problem with one of my remote actions. I would like to parse CSV file uploaded through form. CSV file is parsing correctly and it takes about 20 sec (its ok, because CSV file is containing urls with download links). After successful parsing my view is not displaying. Funny thing is that view renders when csv file is not selected in form.
#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>'
If I select csv file and submit my form following error displays:
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"
):
I do not understand why rails cant find this template. In case with no file selected alert renders from same file correctly.