rails application doesn't load css/js/images in production-environment

可紊 提交于 2019-12-21 20:39:57

问题


when i run my rails application in production mode images are not displayed and css is not working in my console i got the message ActionController::RoutingError (No route matches "/stylesheets/theme.css"): Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.0ms) but in my view/layout application.html.erb i included the line <%= stylesheet_link_tag 'theme' %> and theme.css is present in the public/stylesheet folder


回答1:


make the following change in config/production.rb

change:

config.serve_static_assets = false

to:

config.serve_static_assets = true

That will fix it, I guarantee



来源:https://stackoverflow.com/questions/6690892/rails-application-doesnt-load-css-js-images-in-production-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!