本文介绍了Heroku不会预编译我的资产,以准备我的资产管道应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Rails 3.1.1让我的资产管道设置与Heroku / Cedar一起工作时遇到了一些麻烦。

我推送了我的应用程序并启动它但没有任何信息表示准备资产管道并且没有静态资产正在投放。没有JS,CSS或图像能够找到,因为没有slu comp编译时间或运行时资产编译正在完成。



任何帮助将不胜感激。

p>

它们描述了在此。这对于知道任何可能无法在application.rb中加载完整rails / all的人很有用,资产管道工作显然需要链轮。

I'm having a bit of trouble getting my asset pipeline setup working with Heroku/Cedar using Rails 3.1.1

I've pushed my application and it launches successfully but there was no message that said "Preparing asset pipeline" and no static assets are being served up. No JS, CSS, or images are able to be found as there is no slug compilation time or runtime asset compilation being done.

Any help would be greatly appreciated.

They describe what should happen during deployment at this link which I'll summarize below:

解决方案

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.

这篇关于Heroku不会预编译我的资产,以准备我的资产管道应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 12:17