使用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
Run Code Online (Sandbox Code Playgroud)
我有rails_12factor gem.这是配置文件:
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 = …Run Code Online (Sandbox Code Playgroud)