rails/rails — Issue #3643: Rails 3.1.1 - Asset Pipeline - asset.prefix not working with resource :assets
Author: nodrog
Created: 2011-11-16 11:26:56+00:00
State: open

I am having an issue with the asset pipeline, I already have a resource / controller called assets. So i have changed assets.prefix option to "/externals".

config.assets.prefix = '/externals'

This simple dose not work unless i remove:

resources: assets

Then all works as expected.

I am not sure how to write a test to prove this but i have created a app to showcase it.

https://github.com/nodrog/asset-pipeline-issue

If you run the app, and visit '/products' all will work, then go to the routes file and change the variable create_bug to true.

We have looked into https://github.com/rails/rails/blob/master/actionpack/lib/sprockets/helpers/rails_helper.rb, and then added a debugger to the asset_path method.

This method is not called, if you but a debugger in the javascript_include_tag method. And run method(:asset_path).source_location, it tells you it is calling the method from default routes not from the sprockets helper.

Any help would be greatly appreciated...