Rails 3.1.1 - Asset Pipeline - asset.prefix does not work with the resource: assets

I have a problem with the asset pipeline, I already have a resource / controller called assets. Therefore, I changed the assets.prefix parameter to "/ externals".

config.assets.prefix = '/externals' 

This simple dose does not work if I do not delete:

 resources: assets 

Then everything works as expected.

I'm not sure how to write a test to prove it, but I created an application to demonstrate it.

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

If you run the application and visit "/ products", everything will work, then go to the routes file and change the create_bug variable to true.

We looked at 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 are only a debugger in the javascript_include_tag method. And run the (: resource_path) .source_location method, it tells you that it is calling the method from the default routes, and not from the asterisk helper.

Any help would be greatly appreciated ...

+6
source share
1 answer

UPDATE:

I reported this to the rail people and they fixed it. The fix is ​​now in the main branch.

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

+3
source

Source: https://habr.com/ru/post/901506/


All Articles