【发布时间】:2015-10-16 03:01:04
【问题描述】:
我尝试像这样读取文本文件:
file = File.read(record.file)
并收到错误no implicit conversion of Paperclip::Attachment into String
所以我在末尾附加了 to_s 以将其转换为字符串:
text = File.read(record.file.to_s)
我收到了错误No such file or directory @ rb_sysopen
我知道这个文件和目录存在是因为我有一个重定向到该文件的锚标记,这不受在末尾附加 to_s 的影响。
我尝试手动粘贴文件路径,但收到同样的错误。
【问题讨论】:
标签: ruby-on-rails string file text directory