Heroku is not pre-compiling my assets to prepare my app for asset pipeline

大城市里の小女人 提交于 2019-12-03 03:22:42

Ok so the solution was this:

I'm using mongoid which has you remove the 'rails/all' line as part of the configuration. As a result sprockets was not being loaded.

What you need to do with rails 3.1+ is also add require "sprockets/railtie" in application.rb so that sprockets are enabled. Boom, works.

This info can be found on the mongoid website here. This is useful to know for anyone who may not be loading the full 'rails/all' in application.rb, sprockets is obviously required for the asset pipeline to work.

Have you seen this article on Rails 3.1 asset pipeline on Heroku - http://devcenter.heroku.com/articles/rails31_heroku_cedar. I reviewed it yesterday and picked up a good few hints from it and I've been running Rails 3.1 sites on Heroku for quite a while now.

Was this a new Rails 3.1 site or a site upgraded to Rails 3.1, things to check would be that the asset pipeline is enabled for production - by default Rails 3.1 uses

config.assets.enabled = false

in application.rb. Are you using app/assets for your assets and not public/

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