Reputation: 20648
I have tried to load an image to an image tag by rails as follows. The path is correct .
<%= image_tag("581efb2dcd752bacafda09c4deaba141b76693d1.jpg")%>
it renders as below and when I open it from the firebug it said image cannot be loaded . What can possibly go wrong here?
<img src="/home/kalanamith/Documents/projects/test/private/documents/blackandwhite/581efb2dcd752bacafda09c4deaba141b76693d1.jpg">
Upvotes: 0
Views: 59
Reputation: 1416
The solution is really simple. You can specify where your rails will look for assets and add these directories.
in your environments files you can add
# development.rb for example
config.assets.paths << "/home/kalanamith/Documents/projects/test/private/documents/"
so
<%= image_tag("/blackandwhite/581efb2dcd752bacafda09c4deaba141b76693d1.jpg")%>
will work fine.
Upvotes: 1