繁体   English   中英

ActionView :: Template :: Error(未预编译):在heroku雪松上

[英]ActionView::Template::Error ( isn't precompiled): on heroku cedar

更新:

事实证明,有时results.image是零或“”,所以这打破了应用程序,因为资产管道正在寻找像“”这样的图像而没有找到它。 现在我没有显示图像,如果没有图像,但我将不得不为缺失的图像添加默认图像......这应该是一个更永久的修复。


关于heroku cedar和Rails资产管道这个问题我有很多问题,我尝试了很多解决方案,但是没有一个能够解决,而且可能是因为我遇到的问题有一个问题我没见过其他地方。

我的应用程序使用Rails 3.2.6,我已经将它部署在Heroku的雪松堆栈上。 这是一个基本的搜索应用程序,通过websolr搜索附加的postgres数据库,所以当你加载索引(索引#index)而没有params [:q] .present? 你有一个搜索框,这很好用。 但是当我在搜索框中输入内容并点击提交,并且索引#index再次加载但这次尝试显示结果时,我得到:

app[web.1]: Completed 500 Internal Server Error in 440ms
app[web.1]: 
app[web.1]: ActionView::Template::Error ( isn't precompiled):
app[web.1]:     12:         - @results.each do |result|
app[web.1]:     13:           %li
app[web.1]:     14:             %div
app[web.1]:     15:               = image_tag result.image
app[web.1]:     16:             %div
app[web.1]:     17:               = result.title
app[web.1]:     18:             %div
app[web.1]:   app/views/index/index.html.haml:15:in `block in _app_views_index_index_html_haml___4350601325072829986_32734540'
app[web.1]:   app/views/index/index.html.haml:12:in   _app_views_index_index_html_haml___4350601325072829986_32734540'

关于我的具体案例和我见过的其他人有什么奇怪的是以下几行:

ActionView::Template::Error ( isn't precompiled):

对于我所见过的所有其他问题,括号中有一个css文件,即(“foo.css”未预编译),或者在我看来它应该是(“index.css”)没有预编译)。 但这里只是空白!

这是我试图开始工作的暂存部署,所以我尝试运行RAILS_ENV =暂存rake资产:precompile(然后提交结果),但这并没有解决它。 我甚至尝试在视图中删除(注意那里没有任何实际的样式)。 什么都行不通,我很茫然。 任何帮助将不胜感激。

作为参考,这是我的gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.6'
gem 'pg'
gem 'haml-rails'
gem 'mongoid'
gem 'sunspot_rails', '~> 1.3.0'
gem 'sunspot_solr'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

group :development do
  gem 'heroku_san'
  gem 'annotate'
  gem 'awesome_print'
end

group :development, :test do
  gem 'rspec-rails'
end

group :test do
  gem 'cucumber-rails', :require => false
  gem 'capybara'
  gem 'database_cleaner'
  gem 'spork'
  gem 'launchy'
end

group :staging, :production do
  gem 'thin'
end

以下是我的config / application.rb文件中的配置选项:

config.encoding = "utf-8"
config.filter_parameters += [:password]
config.active_support.escape_html_entities_in_json = true
config.active_record.whitelist_attributes = true
config.assets.enabled = true
config.assets.version = '1.0'
config.assets.compile = true

以下是我的environment / staging.rb文件中的配置选项:

config.cache_classes = true
config.consider_all_requests_local       = false
config.action_controller.perform_caching = true
config.serve_static_assets = false
config.assets.compress = true
config.assets.compile = true
config.assets.precompile += ['index.css.scss']
config.assets.digest = true
config.i18n.fallbacks = true
config.active_support.deprecation = :notify

你有可能在某个地方有一个空图像URL吗? 你有安装CarrierWave的东西吗?

我从你的代码中看到image_tag result.image服务了 - 这可能是null吗?

这个线程应该解决它: ActionView :: Template :: Error(未预编译):

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM