【发布时间】:2011-10-02 18:57:59
【问题描述】:
我正在使用 Rails 3.1 应用程序并部署到 Heroku Cedar。
推送应用时,Heroku 会跳过预编译步骤而不会抛出错误:
Your bundle is complete! It was installed into ./vendor/bundle
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Rails plugin injection
Injecting rails_log_stdout
Injecting rails3_serve_static_assets
-----> Discovering process types
Procfile declares types -> (none)
Default types for Ruby/Rails -> console, rake, web, worker
-----> Compiled slug size is 16.2MB
-----> Launching... done, v35
我上次推送到 Heroku 时(可能是一个月前)预编译资产没有问题。
gem 'rails', '3.1.1.rc2', :git => 'git://github.com/rails/rails.git', :branch => '3-1-stable'
更新:
通过从 application.rb 中删除以下内容,我能够让 Heroku 进行预编译:
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require *Rails.groups(:assets => %w(development test))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
并替换为:
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require *Rails.groups(:assets) if defined?(Bundler)
【问题讨论】:
-
这似乎对我有用。推送到heroku仍然说有错误,但页面加载正确。