【发布时间】:2016-07-28 02:40:36
【问题描述】:
使用 Dokku 在 Digital Ocean 上运行 Rails 4 应用程序。用户可以通过回形针上传图像。我可以很好地上传图像,应用程序运行良好并显示所有图像。一旦我做了一个像文本更改这样的小改动并运行 $git push dokku master,所有上传的图像都是 404。
型号:
class ProductImage < ActiveRecord::Base
has_attached_file :image, default_url: "/images/:style/missing.png",
:path =>":rails_root/public/system/:attachment/:id/:basename_:style.:extension",
:url =>"/system/:attachment/:id/:basename_:style.:extension",
styles: { thumb: ["64x64#", :jpg], medium: ['200x200>', :jpg],
large: ['400x400>', :jpg] }
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
belongs_to :product
end
我有 rails_12factor 宝石。这是 config 文件:
Rails.application.configure do
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.assets.js_compressor = :uglifier
config.assets.compile = true
config.assets.digest = true
config.log_level = :debug
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.log_formatter = ::Logger::Formatter.new
config.active_record.dump_schema_after_migration = false
end
任何帮助将不胜感激!
【问题讨论】:
标签: ruby-on-rails ruby paperclip dokku