Create csv from csv content

This commit is contained in:
Adam
2015-12-31 00:07:43 +01:00
parent d73b8ca8d8
commit ca91c3d16f
2 changed files with 23 additions and 3 deletions

View File

@@ -43,6 +43,18 @@ class ItemsController < ApplicationController
["Import items", "import_items"],
["Update prices", "update_prices"] ]
@csv_content = params[:csv_content]
@error_message = ""
@error_message = "Format of CSV is wrong (CSV content is empty)" if params[:csv_content] == ""
csv_file = ItemsHelper::create_csv(CSV.parse(params[:csv_content]))
begin
ensure
csv_file.unlink
end
render :template => "items/export_import"
end
end