上传是用carrierwave
的
上传了一个 pdf,想在前端显示上传 pdf 的文件名,可提取出来是/uploads/pdf/16/Ubuntu_MySQL.pdf
这个怎么就截取后面的文件名
File.basename ?? http://www.ruby-doc.org/core-2.1.0/File.html#method-c-basename
@liprais NoMethodError: undefined method `split' for #PdfUploader:0xbbc5b50,现在就是不知道怎么从 carrierwave 中提取文件路径。
pro.pdf
=> #<PdfUploader:0xbbc5b50 @model=#<Product id: 16, title: "fgkasgdhs", number: nil, pdf: "Ubuntu_MySQL.pdf", video: nil, color: nil, listtext: "", techparams: "", detail: "", created_at: "2014-01-14 00:21:45", updated_at: "2014-02-18 02:54:01", tag_id: 22, outline: "", category_id: 6>, @mounted_as=:pdf, @storage=#<CarrierWave::Storage::File:0xbbc5808 @uploader=#<PrintpdfUploader:0xbbc5b50 ...>>, @file=#<CarrierWave::SanitizedFile:0xbbc54ac @file="/home/york/yolift/public/uploads/product/ppdf/16/Ubuntu_MySQL.pdf", @original_filename=nil, @content_type=nil>, @versions={}>