我很新的轨道,似乎有问题与回形针宝石。我安装了gem,它在开发(localhost:3000)中运行良好,但是当我在heroku服务器上运行它时,出于某种原因它不想附加文件,并且应用程序中断(错误500页)。paperclip在开发中工作,但不在生产中工作?
下面是我跑过的过程...我将文件推送到heroku,heroku运行rake db:migrate(添加回形针迁移),然后运行heroku restart(重新启动应用程序,并进行新的迁移)。这似乎没有帮助。
这里是我有回形针代码:
user.rb型号:
has_attached_file :avatar,
:styles => {:small => "70x70>"},
:url => "https://stackoverflow.com/users/:attachment/:id/:style/:basename.:extension",
:path => ":rails_root/public/users/:attachment/:id/:style/:basename.:extension"
validates_attachment_size :avatar, :less_than => 500.kilobytes
validates_attachment_content_type :avatar, :content_type => ['image/jpeg', 'image/png']
edit_form.html.haml观点:
= form_for (@user || User.new), :html => { :multipart => true } do |f|
...
.profile_picture.text_field
= image_tag current_profile.avatar.url(:small)
%br
= f.file_field :avatar
再次,由于某种原因,在开发中运行良好,但在生产中出现故障。任何指针将不胜感激......我似乎不能解决这个问题,这是非常令人沮丧的。非常感谢您的时间和任何帮助!
非常感谢你为此......我一定会去做那件事。谢谢! –