Reputation: 1413
What I'm attempting to accomplish here seems straightforward enough but has been a bit of a hassle. I'm just trying to access images that are within the assets/images directory via my browser. So, let's say I have a file whose location is
assets/images/my_file.png
You'd think one of the following would work:
http://localhost:3000/assets/images/my_file.png
http://localhost:3000/assets/my_file.png
But neither does.
Is there something about the asset pipeline that I'm misunderstanding here?
Upvotes: 1
Views: 32
Reputation: 623
In rails 3 and 4, you just get rid of the 'images' part of the path. So an image that lives in /assets/images/my_file.png will actually be accessible in a get request at this url -/assets/my_file.png
Because the assets/images folder gets generated along with a new rails 4 app, this is the convention that they probably want you to follow. I think that's where image_tag will look for it, but I haven't tested that yet.
Upvotes: 1
Reputation: 1466
Use this link:
localhost:3000/assets/my_file.png
Moreover,check whether you have used <%=asset_path('my_file.png')%>
in your view or not. Hope this helps.
Upvotes: 1