0

我偶尔会在我的生产中遇到这个错误。我无法复制它——不是在开发中,也不是在产品中。如果重新运行导致此错误的相同请求,则在几次尝试后它可以工作。为什么会这样?

另一个问题是异常记录器也没有捕获这个错误——也许这是一个线索,但不确定。欢迎任何建议

TypeError (can't dump hash with default proc):
  activesupport (3.2.2) lib/active_support/message_verifier.rb:53:in `dump'
  activesupport (3.2.2) lib/active_support/message_verifier.rb:53:in `generate'
  actionpack (3.2.2) lib/action_dispatch/middleware/cookies.rb:297:in `[]='
  actionpack (3.2.2) lib/action_dispatch/middleware/session/cookie_store.rb:67:in `set_cookie'
  rack (1.4.1) lib/rack/session/abstract/id.rb:330:in `commit_session'
  rack (1.4.1) lib/rack/session/abstract/id.rb:206:in `context'
  rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
  actionpack (3.2.2) lib/action_dispatch/middleware/cookies.rb:338:in `call'
  activerecord (3.2.2) lib/active_record/query_cache.rb:64:in `call'
  activerecord (3.2.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
  actionpack (3.2.2) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  activesupport (3.2.2) lib/active_support/callbacks.rb:405:in `_run__462345741__call__579728663__callbacks'
  activesupport (3.2.2) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.2) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  activesupport (3.2.2) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.2) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  rack (1.4.1) lib/rack/sendfile.rb:102:in `call'
  actionpack (3.2.2) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  actionpack (3.2.2) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  actionpack (3.2.2) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.2) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.2) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.2) 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.2) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  rack-rewrite (1.2.1) lib/rack/rewrite.rb:20:in `call'
  actionpack (3.2.2) lib/action_dispatch/middleware/static.rb:61:in `call'
  rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
  rack-cache (1.2) lib/rack/cache/context.rb:143:in `pass'
  rack-cache (1.2) lib/rack/cache/context.rb:155:in `invalidate'
  rack-cache (1.2) lib/rack/cache/context.rb:71:in `call!'
  rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
  railties (3.2.2) lib/rails/engine.rb:479:in `call'
  railties (3.2.2) lib/rails/application.rb:220:in `call'
  railties (3.2.2) lib/rails/railtie/configurable.rb:30:in `method_missing'
  passenger (3.0.11) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
  passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
  passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
  passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
  passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
  passenger (3.0.11) lib/phusion_passenger/utils.rb:479:in `safe_fork'
  passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:180:in `start'
  passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
  passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
  passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
  <internal:prelude>:10:in `synchronize'
  passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  passenger (3.0.11) helper-scripts/passenger-spawn-server:99:in `<main>'
4

1 回答 1

2

那么问题如下我正在将错误填充到flash [:alert]中

flash[:alert] = new_user.errors

我把它改成了

flash[:alert] = new_user.errors.full_messages.join(",")

并且错误得到了解决。显然错误数组无法转储,因此错误。

于 2012-08-04T05:42:49.320 回答