Images and assets not working in my production server on rails 3.1.0

后端 未结 3 1941
栀梦
栀梦 2020-12-14 04:21

I switched my server to production and i cannot get any of my images to load. It all works fine on development mode but when i switched to production it all stopped working

3条回答
  •  死守一世寂寞
    2020-12-14 05:16

    Remember to run rake assets:precompile in your production environment.

    If you need are deploying with Capistrano, you can use this recipe:

    before "deploy:symlink", "assets:precompile"
    
    namespace :assets do
      desc "Compile assets"
      task :precompile, :roles => :app do
        run "cd #{release_path} && rake RAILS_ENV=#{rails_env} assets:precompile"
      end
    end
    

提交回复
热议问题