我刚刚部署了一个 rails 应用程序,它使用 Paperclip 处理文件上传到运行 apache2、passenger、rails 3.2.3 和 ruby 1.9.3 的 linux ubuntu 10.04 服务器。
我的设置在开发中工作得非常好,但是现在在生产图像中永远不会保存。
我在 production.rb 中注释掉了以下几行,以便 rails 处理文件上传,并尝试使用和安装 XSendFile。
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
和我的图片.rb
attr_accessible :photo_file_name, :photo_file_size, :photo_content_type, :photo, :splash_image
validates_presence_of :photo_file_name, :photo_content_type, :photo_file_size
has_attached_file :photo,
styles: {
thumb: "150x150>"
},
url: "/assets/splash_images/:id/:style/:basename.:extension",
path: ":rails_root/public/assets/splash_images/:id/:style/:basename.:extension"
validates_attachment_size :photo, :less_than => 25.megabytes
validates_attachment_content_type :photo, content_type: /image/
有谁知道会发生什么?非常感谢