Where do app images get stored in Rails 3.1?
With the introduc开发者_JS百科tion of the new directory structure in 3.1 (i.e. app/assets/), should app images (logo, banner, icons, main bg, etc) still be stored in public/images or should they go into app/assets/images?
Someone mentioned:
I would be shocked if anything in app/assets can be served publicly - that wouldn't make sense from either a security viewpoint or from honoring the convention of the public directory. Since you need these flash files to be publicly accessible, you should store them in public.
Valid point. Which brings me to the question:
Based on above understanding. What about the app images? If images such as logo, banner, main background, icons are considered public, why is there an images directory in app/assets?
Or should we still put these types of images in public/images. If so, what is the images dir in app/assets used for?
Note: I haven't looked at Rails 3.1 yet...
As far as I understood DHH's keynote, app/assets
was introduced so you could structure your application in a better way. But there's nothing wrong with storing images in Thanks to Michiel for pointing out that public/images
.public/images
will no longer be with us in Rails 3.1!
The public
folder will the replaced by the assets
folder. That's the folder that your web server will point to. Files from app/assets
, lib/assets
or other places will be copied (images) or compiled (css, js) to assets
.
That means that assets
is now considered a build directory, and you shouldn't store anything there - you might even decline to put it under version control, and just have the server generate or copy the images and css and scripts when you deploy.
See also: http://blog.nodeta.com/2011/06/14/rails-3-1-asset-pipeline-in-the-real-world/
精彩评论