Rails 3.1-Postgres-在控制台中工作,但不能在Webrick中工作



我们有一个大型、复杂的rails应用程序,我们正开始从2.8 迁移到3.1

控制台最终启动,User.last返回预期值。

然而,当我们启动服务器时,User.last最终会在postgresql适配器中引发一个参数错误。

**ArgumentError in HomeController#index
wrong number of arguments (3 for 2)
Backtrace:**
activerecord (3.1.0.rc1) lib/active_record/connection_adapters/postgresql_adapter.rb:546:in `log'
activerecord (3.1.0.rc1) lib/active_record/connection_adapters/postgresql_adapter.rb:546:in `exec_query'
activerecord (3.1.0.rc1) lib/active_record/connection_adapters/postgresql_adapter.rb:1027:in `select'
activerecord (3.1.0.rc1) lib/active_record/connection_adapters/abstract/database_statements.rb:9:in `select_all'
activerecord (3.1.0.rc1) lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
activerecord (3.1.0.rc1) lib/active_record/connection_adapters/abstract/query_cache.rb:74:in `cache_sql'
activerecord (3.1.0.rc1) lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
activerecord (3.1.0.rc1) lib/active_record/base.rb:469:in `find_by_sql_without_trace_ActiveRecord___self_name__find_by_sql'
newrelic_rpm (2.13.4.rum4) lib/new_relic/agent/method_tracer.rb:319:in `find_by_sql'
newrelic_rpm (2.13.4.rum4) lib/new_relic/agent/method_tracer.rb:141:in `trace_execution_scoped'
newrelic_rpm (2.13.4.rum4) lib/new_relic/agent/method_tracer.rb:314:in `find_by_sql'
activerecord (3.1.0.rc1) lib/active_record/relation.rb:106:in `to_a'
activerecord (3.1.0.rc1) lib/active_record/relation/finder_methods.rb:382:in `find_last'
activerecord (3.1.0.rc1) lib/active_record/relation/finder_methods.rb:142:in `last'
activerecord (3.1.0.rc1) lib/active_record/base.rb:440:in `__send__'
activerecord (3.1.0.rc1) lib/active_record/base.rb:440:in `last'
app/controllers/home_controller.rb:23:in `index'
actionpack (3.1.0.rc1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.1.0.rc1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.1.0.rc1) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.1.0.rc1) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.1.0.rc1) lib/abstract_controller/callbacks.rb:18:in `process_action'
activesupport (3.1.0.rc1) lib/active_support/callbacks.rb:461:in `_run__738958071__process_action__199225275__callbacks'
activesupport (3.1.0.rc1) lib/active_support/callbacks.rb:386:in `send'
activesupport (3.1.0.rc1) lib/active_support/callbacks.rb:386:in `_run_process_action_callbacks'
activesupport (3.1.0.rc1) lib/active_support/callbacks.rb:81:in `send'
activesupport (3.1.0.rc1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.0.rc1) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.1.0.rc1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
activesupport (3.1.0.rc1) lib/active_support/notifications.rb:55:in `instrument'
activesupport (3.1.0.rc1) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.1.0.rc1) lib/active_support/notifications.rb:55:in `instrument'
actionpack (3.1.0.rc1) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.1.0.rc1) lib/action_controller/metal/params_wrapper.rb:202:in `process_action'
actionpack (3.1.0.rc1) lib/action_controller/metal/rescue.rb:17:in `process_action'
activerecord (3.1.0.rc1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
newrelic_rpm (2.13.4.rum4) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:34:in `process_action'
newrelic_rpm (2.13.4.rum4) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:252:in `perform_action_with_newrelic_trace'
newrelic_rpm (2.13.4.rum4) lib/new_relic/agent/method_tracer.rb:141:in `trace_execution_scoped'
newrelic_rpm (2.13.4.rum4) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:247:in `perform_action_with_newrelic_trace'
newrelic_rpm (2.13.4.rum4) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:33:in `process_action'
actionpack (3.1.0.rc1) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.1.0.rc1) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.1.0.rc1) lib/action_controller/metal.rb:193:in `dispatch'
actionpack (3.1.0.rc1) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.1.0.rc1) lib/action_controller/metal.rb:236:in `action'
actionpack (3.1.0.rc1) lib/action_dispatch/routing/route_set.rb:65:in `call'
actionpack (3.1.0.rc1) lib/action_dispatch/routing/route_set.rb:65:in `dispatch'
actionpack (3.1.0.rc1) lib/action_dispatch/routing/route_set.rb:29:in `call'
rack-mount (0.8.1) lib/rack/mount/route_set.rb:152:in `call'
rack-mount (0.8.1) lib/rack/mount/code_generation.rb:93:in `recognize'
rack-mount (0.8.1) lib/rack/mount/code_generation.rb:68:in `optimized_each'
rack-mount (0.8.1) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.8.1) lib/rack/mount/route_set.rb:141:in `call'
actionpack (3.1.0.rc1) lib/action_dispatch/routing/route_set.rb:531:in `call'
mongo_mapper (0.9.1) lib/mongo_mapper/middleware/identity_map.rb:10:in `call'
newrelic_rpm (2.13.4.rum4) lib/new_relic/rack/developer_mode.rb:20:in `call'
actionpack (3.1.0.rc1) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.3.0) lib/rack/etag.rb:23:in `call'
rack (1.3.0) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.1.0.rc1) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.1.0.rc1) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.1.0.rc1) lib/action_dispatch/middleware/flash.rb:243:in `call'
rack (1.3.0) lib/rack/session/abstract/id.rb:195:in `context'
rack (1.3.0) lib/rack/session/abstract/id.rb:190:in `call'
actionpack (3.1.0.rc1) lib/action_dispatch/middleware/cookies.rb:321:in `call'
activerecord (3.1.0.rc1) lib/active_record/query_cache.rb:54:in `call'
activerecord (3.1.0.rc1) lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `call'
actionpack (3.1.0.rc1) lib/action_dispatch/middleware/callbacks.rb:29:in `call'
activesupport (3.1.0.rc1) lib/active_support/callbacks.rb:392:in `_run_call_callbacks'
activesupport (3.1.0.rc1) lib/active_support/callbacks.rb:81:in `send'
activesupport (3.1.0.rc1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.0.rc1) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
actionpack (3.1.0.rc1) lib/action_dispatch/middleware/reloader.rb:68:in `call'
rack (1.3.0) lib/rack/sendfile.rb:102:in `call'
actionpack (3.1.0.rc1) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.1.0.rc1) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.1.0.rc1) lib/rails/rack/logger.rb:13:in `call'
rack (1.3.0) lib/rack/methodoverride.rb:24:in `call'
rack (1.3.0) lib/rack/runtime.rb:17:in `call'
activesupport (3.1.0.rc1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.3.0) lib/rack/lock.rb:34:in `call'
actionpack (3.1.0.rc1) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.1.0.rc1) lib/rails/rack/content_length.rb:16:in `call'
railties (3.1.0.rc1) lib/rails/engine.rb:438:in `call'
railties (3.1.0.rc1) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.3.0) lib/rack/handler/webrick.rb:59:in `service'
/Users/jluckett/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/Users/jluckett/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/Users/jluckett/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/Users/jluckett/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:162:in `start'
/Users/jluckett/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/Users/jluckett/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:95:in `start'
/Users/jluckett/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:92:in `each'
/Users/jluckett/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:92:in `start'
/Users/jluckett/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:23:in `start'
/Users/jluckett/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.3.0) lib/rack/handler/webrick.rb:13:in `run'
rack (1.3.0) lib/rack/server.rb:265:in `start'
railties (3.1.0.rc1) lib/rails/commands/server.rb:70:in `start'
railties (3.1.0.rc1) lib/rails/commands.rb:54
railties (3.1.0.rc1) lib/rails/commands.rb:49:in `tap'
railties (3.1.0.rc1) lib/rails/commands.rb:49
script/rails:6:in `require'
script/rails:6

看起来您使用的是Rails 3.1中还不支持的New Relic:http://support.newrelic.com/help/discussions/support/7114-rails-31-and-new-relic

我没有NewRelic(或静默postgres)问题,但我们在某个时候混淆了log方法。

如果以上答案没有帮助,请四处看看,看看您或您的gem/插件是否正在包装ActiveRecord适配器的"log"方法。

我通过捕捉异常、删除"binding.prick"并转储"show method log"

来使用prick调试它

相关内容

  • 没有找到相关文章

最新更新