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?


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.


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.

  • 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.


    What is your server log saying? I had an issue with calling image URLs inside resource views.

    First, maybe try <%= image_tag "image.png" %>

    If you don't want to use image_tag , play with the leading / - depending on where you call the image, Rails may prepend a resource onto the request, so assets/image.png called from a user view may request /users/image.png , whereas /assets/image.png may render the correct path.

    链接地址: http://www.djcxy.com/p/13850.html

    上一篇: 如何在后台启动记录iOS音频会话?

    下一篇: Rails 4映像目录不再存在于资产中