在 heroku 上部署 Rail 4.1.5 + Mongoid 应用程序

Deploy Rail 4.1.5 + Mongoid app on heroku

我是 heroku 的新手,我正在尝试在 heroku 上部署应用程序。我收到以下错误。应用程序是在 Rail 4.1.5 中构建的,我正在使用 mongoid,为此我正在使用 heroku

的 mongolab 插件
remote:        Running: rake assets:precompile
remote:        rake aborted!
remote:        NoMethodError: undefined method `active_record' for #<Rails::Application::Configuration:0x007fddc83c9080>
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/railtie/configuration.rb:95:in `method_missing'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/config/environments/production.rb:81:in `block in <top (required)>'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/railtie.rb:210:in `instance_eval'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/railtie.rb:210:in `configure'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/config/environments/production.rb:1:in `<top (required)>'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `block in require'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in `load_dependency'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/engine.rb:594:in `block (2 levels) in <class:Engine>'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/engine.rb:593:in `each'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/engine.rb:593:in `block in <class:Engine>'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/initializable.rb:30:in `instance_exec'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/initializable.rb:30:in `run'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/initializable.rb:55:in `block in run_initializers'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/initializable.rb:44:in `each'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/initializable.rb:44:in `tsort_each_child'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/initializable.rb:54:in `run_initializers'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/application.rb:300:in `initialize!'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/config/environment.rb:5:in `<top (required)>'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/application.rb:276:in `require'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/application.rb:276:in `require_environment!'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/railties-4.1.5/lib/rails/application.rb:379:in `block in run_tasks_blocks'
remote:        /tmp/build_858cf4853394f7ea607169cfc9da45c7/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.2.2/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
remote:        Tasks: TOP => environment
remote:        (See full trace by running task with --trace)
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote: 
remote:  !     Push rejected, failed to compile Ruby app

您的堆栈跟踪显示问题出在链轮 gem 上。您确定您设置了配置以充分摆脱 ActiveRecord 吗?仔细检查 here.

您可能需要在 config/application.rb 中注释掉 require "sprockets/railtie"