2

我将图像添加到 /app/assets/images 文件夹 logo-small.jpg

然后我将此行添加到我的视图中

= link_to image_tag('logo-small.jpg'), root_path, :class => 'brand'

然后我预编译,

rake assets:precompile RAILS_ENV=production

git add、git commit 和 git push heroku master。推动工作。

我仍然收到错误

ActionView::Template::Error (logo-small.jpg isn't precompiled):

为什么?

编辑:我尝试了其他图像,它们很好。Heroku 的 logo 和 logo-small 有问题,但其他图像没有。wtf??

4

2 回答 2

1

如果你在 heroku 的 Cedar 堆栈上,你的资产应该在你推送到 heroku 时自动预编译。如果您在该堆栈上并且仍然遇到错误,那会很高兴知道。

如果您使用的是 Bamboo 堆栈(有点旧,但曾经是默认堆栈),您可以尝试在服务器上运行rake 任务,让它编译您已经推送的资产。

heroku run rake assets:precompile
于 2012-07-20T22:24:04.370 回答
1

从来没有发现它是什么。将格式从jpg切换到png,它工作。

于 2012-07-22T16:20:44.893 回答