0
設置Apache服務器當我們選擇要導入我收到以下錯誤消息.csv文件後:導入.csv格式文件轉換成openproject
類型錯誤在ProductImportsController#create
:
no implicit conversion of ActiveSupport::HashWithIndifferentAccess into String
我product_imports_controller.rb
:
require 'csv'
class ProductImportsController < ApplicationController
def new
@product_import = ProductImport.new
end
def create
csv_text = File.read(params[:product_import])
csv = CSV.parse(csv_text, :headers => true)
csv.each do |row|
ProductImport.create!(row.to_hash)
end
end
end
可以共享參數,可以說你是在日誌中得到些什麼? –
你能分享回溯/日誌嗎? – user3402754
TypeError(不支持將ActiveSupport :: HashWithIndifferentAccess隱式轉換爲String): app/controllers/product_imports_controller.rb:8:在'read'中 app/controllers/product_imports_controller.rb:8:在'create' – Ajay