Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 4 image directory not present in assets anymore

When creating a new Rails 4 project, I have javascripts and stylesheets directories inside the app/assets folder, but I no longer see the images directory. Are we supposed to be putting our images in another folder?

UPDATE: I created an images directory in the assets folder. Unfortunately, that doesn't work. If I try to load an image with <img src="/assets/my_image.jpg"/>, it can't be found. Seems like I need to somehow enable my images directory?

like image 504
at. Avatar asked May 30 '13 17:05

at.


2 Answers

Rails 4.* now have images folder under app/assets/images/

JS/CSS/IMAGES are now part of the rails app, in previous you might put them under public folder, further reading.

like image 69
Aung Zan Baw Avatar answered Nov 18 '22 06:11

Aung Zan Baw


I ran into the same problem and have reached at least a temporary solution. I haven't figured out all the little details yet but here is one thing I have discovered.

  1. Rails 4.0.0 (released today, June 25th) has an assets/images directory when you create a new app whereas rails 4.0.0.RC2 didn't - you had to create one and for some odd reason even then images weren't rendering for me.

I updated my rails 4.0.0.RC2 app to rails 4.0.0 but still had problems with images. However, when I created a new rails 4 app the images rendered just fine. As I searched all over for a solution to the image problem I noticed @at. posted a number of different SO posts about this same issue. I wanted to let you know what I found. I'll update when I find out more.

like image 43
lflores Avatar answered Nov 18 '22 08:11

lflores