LoginSignup
0

More than 3 years have passed since last update.

Rails 画像の読み込み public か app/assets/images

Last updated at Posted at 2019-07-23

画像を使いたい時。

Progateではpublicディレクトリで画像を読み込みますが、
別の方法もあります。
app/assets/imagesディレクトリで読み込む方法。

app/assets/imagesの方が、キャッシュが残らないとのこと。

"アセットパイプライン"によってアセットを最小化、ファイルを連結して1つにするフレームワーク、
ページの読み込み時間が大幅に短縮できるそう。
(JPGかPNGでダウンロードします。)

結論:app/assets/imagesで画像を読み込んだほうが良いかも?

参考
https://techblog.kyamanak.com/entry/2017/10/13/003818
https://railsguides.jp/asset_pipeline.html

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0