尝试按照标题说使用carrierwave,但没有太多运气,因为我收到以下错误:
TypeError - no implicit conversion of CsvFile into String:
这是我的post方法,它失败了:
post '/file' do
file_data = params[:csv_file][:tempfile]
file_name = params[:csv_file][:filename]
file_path = "app/public/csv_files/#{file_name}"
date = Time.now.strftime("%d/%m/%Y %H:%M")
csv_file = CsvFile.new(name: file_name,
path: file_path,
date: date,
file: file_data
)
file = CSV_File_Reader.new(file_path)
erb(:finished)
end
这是我的CsvFile类:
class CsvFile
include DataMapper::Resource
property :id, Serial
property :name, String
property :path, String
property :date, String
mount_uploader :file, File
has n, :images
end
所有的游行都应该尽可能地通过,但由于我对此很陌生,我明显遗漏了一些东西,谷歌搜索对我来说并不起作用。任何帮助都会很棒。感谢