This gotcha with the Rails 3.1 Asset Pipeline is tricky!
Say you want to statically render your assets for your production environment, but don’t want to use a digest.
Watch out! If you do so in the working directory of your development environment, you might end up including all your assets twice. You might not even notice unless jquery-ujs powered ajax requests like form submits get triggered twice.
Here’s what happened to me:
- I set config.assets.digest = false in config/environments/production.rb.
- Sure, it makes sense to have RedBrick or Thin-based Rack servers serve static files in development mode, but perhaps, if the assets pipeline is on, it should skip serving the static files in public/assets/application.js or public/assets/application.css?
As a workaround, I set my config.assets.prefix in config/environments/development.rb to /devassets. Then of course I have to handle images for web-app-theme (and rails admin, too probably), so I created a folder in public called devassets and created symlink in it to public/images/web-app-theme.
Its a pain, sure, but I’m confident these asset pipeline issues will get sorted out soon enough.
I also discuss this at StackOverflow: