Active Admin Gem – Rails 3.2.3,Heroku错误日志

我在理解错误日志时遇到问题。 我正在使用Active Admin,一切都在我的本地服务器上运行良好但是当我推送到Heroku时我无法登录或使用活动管理员。 关于问题是什么,我有点困惑。 我妻子的前端工作,但当我第一次尝试登录时,我收到此错误。

我跑了

heroku run rake db:migrate 

application.rb中

  config.assets.initialize_on_precompile = false 

的routes.rb

  break if ARGV.join.include? 'assets:precompile' 

Heroku记录

 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/responder.rb:153:in `respond' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/responder.rb:146:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/mime_responds.rb:239:in `respond_with' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/app/controllers/devise/sessions_controller.rb:9:in `new' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/implicit_render.rb:4:in `send_action' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/base.rb:167:in `process_action' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/callbacks.rb:18:in `block in process_action' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/rendering.rb:10:in `process_action' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:436:in `_run__2148348972389484395__process_action__581573497384646045__callbacks' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in `__run_callback' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:81:in `run_callbacks' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/callbacks.rb:17:in `process_action' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/rescue.rb:29:in `process_action' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in `block in instrument' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/notifications.rb:123:in `instrument' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/instrumentation.rb:29:in `process_action' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/params_wrapper.rb:205:in `process_action' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.3/lib/active_record/rai lties/controller_runtime.rb:18:in `process_action' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/base.rb:121:in `process' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/rendering.rb:45:in `process' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal.rb:203:in `dispatch' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal.rb:246:in `block in action' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:73:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:73:in `dispatch' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:36:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/routing/mapper.rb:40:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/journey-1.0.3/lib/journey/router.rb:68:in `block in call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/journey-1.0.3/lib/journey/router.rb:56:in `each' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/journey-1.0.3/lib/journey/router.rb:56:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/routing/route_set.rb:600:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/sass-3.1.18/lib/sass/plugin/rack.rb:54:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/warden-1.1.1/lib/warden/manager.rb:35:in `block in call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/warden-1.1.1/lib/warden/manager.rb:34:in `catch' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/warden-1.1.1/lib/warden/manager.rb:34:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/etag.rb:23:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/conditionalget.rb:25:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/head.rb:14:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/params_parser.rb:21:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/flash.rb:242:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in `context' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/cookies.rb:338:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/dragonfly-0.9.12/lib/dragonfly/cookie_monster.rb:9:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.3/lib/active_record/query_cache.rb:64:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:467:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in `_run__2527400173333692808__call__757062616006589650__callbacks' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in `__run_callback' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:385:in `_run_call_callbacks' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:81:in `run_callbacks' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/callbacks.rb:27:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/remote_ip.rb:31:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/rack/logger.rb:26:in `call_app' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/rack/logger.rb:16:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/request_id.rb:22:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/cache/strategy/local_cache.rb:72:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/static.rb:62:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/dragonfly-0.9.12/lib/dragonfly/middleware.rb:13:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:479:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/application.rb:220:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/content_length.rb:14:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/rack/log_tailer.rb:14:in `call' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:80:in `block in pre_process' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:78:in `catch' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:78:in `pre_process' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:53:in `process' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:38:in `receive_data' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/backends/base.rb:61:in `start' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/server.rb:159:in `start' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler/thin.rb:13:in `run' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:265:in `start' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in `start' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in ' 2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:50:in `' 2012-06-01T06:11:53+00:00 app[web.1]: script/rails:6:in `require' 2012-06-01T06:11:53+00:00 app[web.1]: script/rails:6:in `' 2012-06-01T06:11:53+00:00 app[web.1]: 2012-06-01T06:11:53+00:00 app[web.1]: 2012-06-01T06:11:53+00:00 app[web.1]: Processing by ActiveAdmin::Devise::SessionsController#new as HTML 2012-06-01T06:11:53+00:00 app[web.1]: Rendered vendor/bundle/ruby/1.9.1/bundler/gems/active_admin-3020d04d5c8f/app/views/active_admin/devise/shared/_links.erb (1.1ms) 2012-06-01T06:11:53+00:00 app[web.1]: Rendered vendor/bundle/ruby/1.9.1/bundler/gems/active_admin-3020d04d5c8f/app/views/active_admin/devise/sessions/new.html.erb within layouts/active_admin_logged_out (292.9ms) 2012-06-01T06:11:53+00:00 app[web.1]: Completed 500 Internal Server Error in 456ms 

配置/ ENV / development.rb

  # Do not compress assets config.assets.compress = false # Expands the lines which load the assets config.assets.debug = true 

gem文件

 source 'https://rubygems.org' ruby '1.9.3' gem 'rails', '3.2.3' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' group :development do gem 'pg' #gem 'sqlite3' end # Gems used only for assets and not required # in production environments by default. group :assets do gem 'pg' gem 'thin' gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', :platform => :ruby gem 'uglifier', '>= 1.0.3' gem 'chosen-rails' end gem 'jquery-rails' gem "activeadmin", :git => "git://github.com/gregbell/active_admin.git" gem "zurb-foundation" gem "friendly_id", "~> 4.0.1" gem 'simple_form' gem 'rack-cache', :require => 'rack/cache' gem 'dragonfly', '~>0.9.12' gem "fog" gem 'rmagick' gem 'tinymce-rails' 

更新:

我在我的gemfile上,我现在正在使用

 ruby '1.9.3' gem 'rails', '3.2.5' 

但错误日志有

 vendor/bundle/ruby/1.9.1/gems/ 

Heroku不应该为我选择Ruby 1.9.3吗?

试试这两件事:

 config/environments/production.rb config.assets.compile = true 

在你的gem文件中

 gem "activeadmin", :git => "git://github.com/gregbell/active_admin.git" 

bundle install

推到heroku看看它是否有效

gem 'sass-rails', '~> 3.2.3'gem 'pg'移出资产组,捆绑并再次尝试。 我会做一个强制性的rake assets:precompile RAILS_ENV=production并将public/assets更新添加到我的提交中。

如果您想要重建资产,只需rm -rf public/assets并再次运行asset precompile命令。

你可以git rm public/assets --cached -rgit add public/assets

做一个提交并推送到heroku。

我只是猜测你没有运行你的迁移,因为pg gem隐藏在你的资产组中。 如果您尝试在这些条件下运行它们,则在发出heroku run rake db:migrate时可能会出现错误。

此外,我建议将您的薄gem放在生产或全球环境中。 确保你有一个Procfile ,否则heroku将使用webrick。

需要将其添加到production.rb

 config.assets.precompile += %w( active_admin.css active_admin.js active_admin/print.css) 

当我忘记运行$ heroku run rake db:migrate时,我得到了非常相似的错误消息。 我创建了一个新的Family模型,并将应用程序的根目录设置为开发中的一个系列#show页面。 我得到了与部署到Heroku时相同的神秘错误消息,并且能够通过在生产数据库中运行迁移并在控制台中创建Family对象来解决它。