Access public files in Rails

I want to access the file /public/images/dog.jpg in a Rails project. Is there some kind of url that would access it?

I tried public/images/dog.jpg and images/dog.jpg , but that didn't work.

+4
source share
1 answer

images/dog.jpg correct.

However, I would use the image_path URL image_path , for example. image_path('dog.jpg') .

See http://guides.rubyonrails.org/asset_pipeline.html#coding-links-to-assets

+3
source

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


All Articles