设置回形针使用S3在我的本地开发的系统是一个单元。不过,我无法得到它的工作在Heroku上。
Setting up paperclip to use S3 on my local dev system was a snap. However, I am not able to get it to work on Heroku.
成功的文件上传:
[paperclip] Saving attachments.
[paperclip] saving photos/2/small.jpg
[paperclip] saving photos/2/original.jpg
然而,视图,尝试链接到上传得到一个路由错误:
However, views that try to link to the upload get a routing error:
ActionController::RoutingError (No route matches "/photos/small/missing.png" with {:method=>:get}):
注意它是如何使用的文件名丢失,并使用png格式因为即使该文件是一个名为.jpg扩展名。
Notice how it is using 'missing' for the file name and is using '.png' for the extension even though the file is a '.jpg'.
我已经试过了无数的组合:网址
和:路径
与选项 has_attached_file
根据不同的博客文章和教程,我发现(包括Heroku的文档),但没有一个似乎工作。
I have tried numerous combinations of the :url
and :path
options with has_attached_file
according the various blog posts and tutorials I have found (including Heroku's docs), but none seem to work.
什么是使用回形针与S3在Heroku上的正确步骤是什么?
What are the correct steps to use paperclip with S3 on Heroku?
发现问题:需要对数据库进行更新
Found the problem: needed to update the database.
heroku rake:db:migrate
heroku restart
我已经做了我认为将完成同样的事情早已: Heroku的耙分贝:模式:负载
,但也许不工作或东西出了问题过程
I had done what I thought would have accomplished the same thing already: heroku rake db:schema:load
, but perhaps that doesn't work or something went wrong in the process.
总之,这样做,以及移除调用attr_accessor的建议在另一个博客,解决了这个问题。
Anyhow, doing that, along with removing the calls to attr_accessor as suggested on another blog, solved the problem.