Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3.1.1 - Asset Pipeline - asset.prefix not working with resource :assets

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...

like image 359
nodrog Avatar asked Nov 15 '11 12:11

nodrog


1 Answers

UPDATE:

I reported this to the rails people, and they fixed it. The fix is now in the master branch.

https://github.com/rails/rails/issues/3643#issuecomment-2775938

like image 99
nodrog Avatar answered Sep 24 '22 22:09

nodrog