Ruby on rails 在Rails的生产模式下未显示回形针图像

Ruby on rails 在Rails的生产模式下未显示回形针图像,ruby-on-rails,ruby-on-rails-3,Ruby On Rails,Ruby On Rails 3,在开发过程中,它工作正常,但在生产模式下,图像不可见,我得到“你要找的页面不存在”错误。我已将此代码放入initalizers/paperclip.rb中 Paperclip::Attachment.default_options.merge!( :path => ":rails_root/public/system/:attachment/:id/:style/:basename.:extension", :url => "/system/:attachment/

在开发过程中,它工作正常,但在生产模式下,图像不可见,我得到“你要找的页面不存在”错误。我已将此代码放入initalizers/paperclip.rb中

Paperclip::Attachment.default_options.merge!(
    :path => ":rails_root/public/system/:attachment/:id/:style/:basename.:extension", 
    :url => "/system/:attachment/:id/:style/:basename.:extension"
)
并用

rake assets:precompile 
在生产模式下,图像仍然没有显示。有什么帮助吗


编辑-好的,我知道了,路径不准确。另外,您可能希望在config/environment/production.rb中启用config.service\u static\u assets=true如果您在本地主机上的生产环境中运行它,则有两个错误-

  • 路径不准确,所以我把它们修好了
  • 另外,如果您在本地主机上的生产环境中运行config.service\u static\u assets=true,则可能需要在config/environment/production.rb中启用它

  • 不建议启用
    服务静态资产
    ,更多信息: