回形针原始网址

时间:2013-04-28 23:59:12

标签: ruby-on-rails ruby paperclip

我需要获取Paperclip上传的文件的文件系统URL。我试过这个

ProjectAttachment.last.attachment.url
ProjectAttachment Load (0.6ms)

SELECT `project_attachments`.* FROM `project_attachments`
ORDER BY `project_attachments`.`id` DESC LIMIT 1 => "/system/project_attachments/attachments/000/000/014/original/Updated_test_v1_2a.xlsx?1367191020"

为什么在文件后添加?1367191020?有没有办法确保不会添加到URL?

1 个答案:

答案 0 :(得分:1)

根据method documentation,默认情况下会将时间戳添加到网址的末尾。所以将代码更改为:

ProjectAttachment.last.attachment.url(:timestamp => false)