rails/rails — Issue #3318: config.assets.digest = true seems to be preventing assets precompile with SWF files (Rails 3.1.0)
Author: jasdel
Created: 2011-10-13 16:36:07+00:00
State: open

Having the config.assets.digest = true in environment/production.rb seems to prevent pre-compilation of swf assets. Disabling this flag, and running rake assets:precompile will compile all the asset files with their hashes. You can then turn the flag back on and access the compiled assets.

When precompilling my assets my swf file not being precompiled would cause the rake task to fail. I've added the custom assets path via

config.assets.paths << "#{Rails.root}/vendor/assets/flash"
to application.rb

I'm using the asset_path from within a js.coffee.erb file as "<%= asset_path('Jplayer.swf') %>"

I'm developing on a linux 32bit ubuntu 11.04, with ruby 1.9.2-p290 on rails 3.1.0.

The issue seems to revolve around generating URL + hash for an swf file. Even with the flag enabled, the swf file has a hash value appended to its name when it's copied to the public/assets folder, but as soon as a js.coffee.erb (maybe others) file uses assets_path helper it is unable to build the precompiled URL+hash.

Disabling the flag, compiling, and then enabling it allows production to work, but no static files will be served up since the URLs are all pointing to the assets original name which will be served by the rails app.

RAILS_ENV=development rake assets:precompile works fine because the hash url flag is disabled, but
RAILS_ENV=production rake assets:precompile will fail at my audio_player.js.coffee.erb file, saying Jplayer.swf is not precompiled, but the Jplayer.swf already exists in the public/assets folder with a hash appended to its name.

I'm pretty new to rails, and not sure how to get better traces. Let me know what I need to do to get more information.