when to put images to app/asssets and when to /public/images in rails 3.1?

二次信任 提交于 2019-12-04 22:25:59

问题


I still don't quite get it, where to put images in rails 3.1, in these situation:

  1. Images are processed (f.e. by paperclip or by dragonfly ) and stored in folder (not with external service like s3, ..f.e. in develompent)
  2. when I have just images, that I'll use in stylesheet (f.e. backrounds)
  3. Icons (AppStore, Facebook ...)

thanx


回答1:


Stylesheet images should be placed in app/assets, while files uploaded by paperclip in public/system. In case of assets , fingerprints will be created for every file, so they can be properly cached. If cached file changes, fingerprint changes too and in such way cache is invalidated.

UPDATE: To reference files in app/assets (e.g. specifying image url in css) you`ll need to use special asset pipeline ERB or SCSS helpers (like image-path and image-url for SCSS and asset_path for ERB).



来源:https://stackoverflow.com/questions/8804225/when-to-put-images-to-app-asssets-and-when-to-public-images-in-rails-3-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!