我正在尝试将我的应用程序部署到Heroku。它显然成功了,但当我尝试运行页面时,我会收到"抱歉出了问题"的消息。我已经运行了"heroku日志"命令,我看到错误显示:
ActionView::Template::Error (vendor/modernizr.js isn't precompiled)
我的Gemfile内容如下:
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'pg'
gem 'foundation-rails'
gem 'debugger'
gem 'activerecord-import'
gem 'jquery-ui-rails'
gem 'jquery-rails'
gem 'ruby-prof', group: :test
gem 'test-unit', group: :test
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
group :production do
gem 'rails_12factor'
end
config/application.rb文件包含:
config.assets.enabled = true
config.assets.version = '1.0
config.assets.initialize_on_precompile = false
config/environments/production.rb包含:
config.assets.compress = true
config.assets.compile = false
config.assets.digest = true
我还参考了application.html.erb 中的modernizr文件
<title><%= content_for?(:title) ? yield(:title) : "Business manager" %></title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "vendor/modernizr" %>
<%= csrf_meta_tags %>
请让我知道如何使这东西工作。非常感谢。
您需要在要预编译的资产列表中添加'modernizr.js'文件。
在environments/production.rb中,将其添加到config.assets.precompile:
config.assets.precompile += %w(modernizr.js)