John
John

Reputation: 4706

Access public files in Rails

I want to access the file /public/images/dog.jpg in the Rails project. Is there some URL route that would access it?

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

Upvotes: 4

Views: 3080

Answers (1)

Michael Durrant
Michael Durrant

Reputation: 96614

images/dog.jpg is correct.

However I would use the image_path URL route, e.g. image_path('dog.jpg').

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

Upvotes: 3

Related Questions