【发布时间】:2013-05-08 09:44:18
【问题描述】:
我有一个 Ruby on Rails OpenShift 应用程序(ruby 1.9,Rails Rails 3.2.13),在开发环境中运行没有问题。但是,当我将应用程序部署到 OpenShift 时,我收到以下错误:
ActionView::Template::Error (logo.png isn't precompiled):
2: <header>
3: <div id="header" class="clearfix landing_header">
4: <a href="#" id="logo">
5: <%= image_tag("logo.png") %>
6:
7: </a>
我了解错误提示 logo.png 未预编译。这是有道理的,因为这些指令是在我的 production.rb 环境中设置的:
config.serve_static_assets = false
config.assets.compress = true
config.assets.compile = false
config.assets.digest = true
嗯,我的资产是预编译的吗?当我部署我的应用程序(使用git push)时,我可以看到:
remote: Precompiling with 'bundle exec rake assets:precompile'
而且没有错误...即使我使用 SSH 在 OpenShift 存储库中搜索预编译的资产,我也可以在那里看到它,与许多其他资产一样:
> ls public/assets | grep logo
logo-66589ea9e7a1caa7f2151a721d6cdbd2.png
当我在浏览器中点击我的应用程序地址/资产/该文件 ^^ 时,我可以看到它。唯一的问题是 image_tag 没有。
我做错了什么?资产是预编译的,不是吗?我是否错误地使用了 image_tag?提前致谢!
【问题讨论】:
标签: ruby-on-rails asset-pipeline assets production-environment openshift