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