Does rails 4 asset_path helper uses asset.prefix? [closed]

Solution 1:

You should double-check your file names as there was a report of a similar bug which turned out to be a typo.

Basically what happens in Rails 4 is that the prefix is omitted if the asset doesn't exist.

You can test the behavior in the Rails Console as they demonstrate on the thread: https://github.com/rails/rails/issues/15873

$ rails new path-test
$ touch app/assets/images/hello.png
$ rails c
Loading development environment (Rails 4.1.1)
>> Rails.application.config.assets.prefix
=> "/assets"
>> ActionController::Base.helpers.asset_path "hello.png"
=> "/assets/hello.png"
>> ActionController::Base.helpers.asset_path "foo.png"
=> "/foo.png"

FYI, you will likely get a quicker response to Rails questions over on Stackoverflow where there is much larger Rails community: https://stackoverflow.com/questions/tagged/ruby-on-rails

Hope this helps