Rails 4: assets not loading in production

前端 未结 18 1433
梦如初夏
梦如初夏 2020-11-29 15:15

I\'m trying to put my app into production and image and css asset paths aren\'t working.

Here\'s what I\'m currently doing:

  • Image assets live in /app/a
18条回答
  •  盖世英雄少女心
    2020-11-29 15:56

    I may be wrong but those who recommend changing

    config.assets.compile = true

    The comment on this line reads: #Do not fallback to assets pipeline if a precompiled asset is missed.

    This suggests that by setting this to true you are not fixing the problem but rather bypassing it and running the pipeline every time. This must surely kill your performance and defeat the purpose of the pipeline?

    I had this same error and it was due to the application running in a sub folder that rails didn't know about.

    So my css file where in home/subfolder/app/public/.... but rails was looking in home/app/public/...

    try either moving your app out of the subfolder or telling rails that it is in a subfolder.

提交回复
热议问题