所有SO用户都在感恩节修复错误
我的延迟作业设置工作正常,我在生产和开发中运行,但是当访问rails admin的用户部分时,我收到错误
未初始化的常量ActiveRecord :: Base :: Delayed :: Job
我应该在某个地方定义延迟的工作班吗?如果是这样,那么正确的语法是什么?延迟::工作或延迟工作?我试过这样做没有成功。
我还运行了迁移来创建jobs表。也许在某个地方定义了用户和延迟工作之间的关联?不太确定......
这是一个完整的痕迹:
ActionView::Template::Error (uninitialized constant ActiveRecord::Base::Delayed::Job):
10:
11: export_action = RailsAdmin::Config::Actions.find(:export, { :controller => self.controller, :abstract_model => @abstract_model })
12: export_action = export_action && authorized?(export_action.authorization_key, @abstract_model) ? export_action : nil
13:
14: properties = @model_config.list.with(:controller => self.controller, :view => self, :object => @abstract_model.model.new).visible_fields
15: # columns paginate
16: @filterable_fields = @model_config.list.fields.select(&:filterable?)
activerecord (3.2.3) lib/active_record/inheritance.rb:119:in `compute_type'
activerecord (3.2.3) lib/active_record/reflection.rb:172:in `klass'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/adapters/active_record.rb:233:in `association_model_lookup'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/adapters/active_record.rb:70:in `block (2 levels) in associations'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/fields/association.rb:63:in `call'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/fields/association.rb:63:in `associated_model_config'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/fields/association.rb:33:in `block in <class:Association>'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/configurable.rb:68:in `instance_eval'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/configurable.rb:68:in `block in register_instance_option'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/configurable.rb:42:in `block in register_instance_option'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/proxyable/proxy.rb:31:in `method_missing'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/has_fields.rb:113:in `select'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/has_fields.rb:113:in `visible_fields'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/proxyable/proxy.rb:31:in `method_missing'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/app/views/rails_admin/main/index.html.haml:13:in `__var_www_apps_miracleticket_shared_bundle_ruby_______bundler_gems_rails_admin____e____d__f_app_views_rails_admin_main_index_html_haml___3620510256847226470_59069620'
actionpack (3.2.3) lib/action_view/template.rb:143:in `block in render'
activesupport (3.2.3) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.3) lib/action_view/template.rb:141:in `render'
actionpack (3.2.3) lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
actionpack (3.2.3) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.3) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.3) lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
actionpack (3.2.3) lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
actionpack (3.2.3) lib/action_view/renderer/template_renderer.rb:45:in `render_template'
actionpack (3.2.3) lib/action_view/renderer/template_renderer.rb:18:in `render'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:156:in `block in render_with_newrelic'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:155:in `render_with_newrelic'
actionpack (3.2.3) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.3) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.3) lib/abstract_controller/rendering.rb:110:in `_render_template'
actionpack (3.2.3) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.3) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.3) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.3) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.3) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.3) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.3) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/home/shark/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
activesupport (3.2.3) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.3) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:39:in `render'
remotipart (1.0.2) lib/remotipart/render_overrides.rb:8:in `render'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/actions/index.rb:35:in `block (4 levels) in <class:Index>'
actionpack (3.2.3) lib/action_controller/metal/mime_responds.rb:196:in `call'
actionpack (3.2.3) lib/action_controller/metal/mime_responds.rb:196:in `respond_to'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/actions/index.rb:32:in `block (2 levels) in <class:Index>'
(eval):8:in `instance_eval'
(eval):8:in `index'
actionpack (3.2.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.3) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.3) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.3) lib/active_support/callbacks.rb:524:in `_run__2345189654170037202__process_action__1989048903076684056__callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
activerecord (3.2.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:34:in `block in process_action'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:268:in `block in perform_action_with_newrelic_trace'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:263:in `perform_action_with_newrelic_trace'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:33:in `process_action'
actionpack (3.2.3) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.3) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.3) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.3) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:600:in `call'
railties (3.2.3) lib/rails/engine.rb:479:in `call'
railties (3.2.3) lib/rails/railtie/configurable.rb:30:in `method_missing'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:600:in `call'
rack-pjax (0.6.0) lib/rack/pjax.rb:12:in `call'
omniauth (1.1.1) lib/omniauth/strategy.rb:177:in `call!'
omniauth (1.1.1) lib/omniauth/strategy.rb:157:in `call'
newrelic_rpm (3.5.0.1) lib/new_relic/rack/error_collector.rb:8:in `call'
newrelic_rpm (3.5.0.1) lib/new_relic/rack/browser_monitoring.rb:12:in `call'
sass (3.2.2) lib/sass/plugin/rack.rb:54:in `call'
exception_notification (3.0.0) lib/exception_notifier.rb:40:in `call'
warden (1.2.1) lib/warden/manager.rb:35:in `block in call'
warden (1.2.1) lib/warden/manager.rb:34:in `catch'
warden (1.2.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/head.rb:14:in `call'
remotipart (1.0.2) lib/remotipart/middleware.rb:30:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.3) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:467:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `_run__3685644371886104563__call__3962699592338143344__callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
rack (1.4.1) lib/rack/sendfile.rb:102:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.3) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
railties (3.2.3) lib/rails/engine.rb:479:in `call'
railties (3.2.3) lib/rails/application.rb:220:in `call'
railties (3.2.3) lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/utils.rb:479:in `safe_fork'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:180:in `start'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/helper-scripts/passenger-spawn-server:99:in `<main>'
答案 0 :(得分:0)
看起来某个类在某个地方与Delayed::Job
类相关联。我猜你在指定Delayed::Job
的那个关联上有class_name选项。我不确定这在实践中会如何起作用,因为Delayed::Job
不是活动的记录类。您必须与延迟作业的活动记录后端关联(Delayed::Backend::ActiveRecord::Job
)。
在第一种情况下,值得评论一下这种关联,看看它是否能够在没有它的情况下发挥作用。在第二个例子中,值得重新思考如何将用户与正在处理的作业相关联。