I am developing a new application with Ruby 1.9.2 and Rails 3.1. When I
deploy the application in development mode, I find all my assets
(images, CSS files, and JS files) listed individually in the HTML:
<link href="/assets/reset.css?body=1" media="screen" rel="stylesheet"
type="text/css" />
<link href="/assets/application.css?body=1" media="screen"
rel="stylesheet" type="text/css" />
<link href="/assets/forms.css?body=1" media="screen" rel="stylesheet"
type="text/css" />
<script src="/assets/jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery_ujs.js?body=1"
type="text/javascript"></script>
<script src="/assets/global.js?body=1" type="text/javascript"></script>
<script src="/assets/application.js?body=1"
type="text/javascript"></script>
Note that the application.* files above are empty in content, but it
doesn’t matter because all the component CSS and JS files are listed
individually. So the page looks as it should. This is development mode,
so I don’t really care that so many HTTP fetches are necessary.
When I deploy in production mode, I find this:
<link href="/stylesheets/application.css" media="screen"
rel="stylesheet" type="text/css" />
<script src="/javascripts/application.js"
type="text/javascript"></script>
These application.* files are still empty because the contents of the
component files are not copied into them, and with the component CSS and
JS files not included individually, my page has no style or
functionality. Also, the lone image on the page isn’t displayed.
I have set config.serve_static_assets = true in production.rb. In
fact, just for fun, I completely copied the contents of development.rb
into production.rb, but the result is the same.
Any insight into what I can do to solve the problem is appreciated.
Thanks and Happy Holidays.