nodrog
nodrog

Reputation: 3532

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

Upvotes: 6

Views: 1908

Answers (1)

nodrog
nodrog

Reputation: 3532

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

Upvotes: 3

Related Questions