We have a large, complex rails app we're beginning to migrate from 2.8 to 3.1
Console finally starts, and User.last returns the expected value.
However, when we fire up the server, User.last ends up causing an argument error deep in the postgresql adapter.
**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
It looks like you're using New Relic, which isn't yet supported in Rails 3.1: http://support.newrelic.com/help/discussions/support/7114-rails-31-and-new-relic
I did not have a New Relic (or silent-postgres) problem, but we were aliasing the log method at some point.
if the above answers don't help, take a look around and see if you, or your gems/plugins are wrapping the ActiveRecord adapter's "log" method.
I debugged this using pry by catching the exception, dropping a "binding.pry" and dumping "show-method log"
Related
I'm using the devise view to reset a User's password.
I'm sending the reset_password_token and the new passwords, and i'm getting this error.
Any ideas?
I'd be happy to any add any necessary details. I'm using rails 3.2 with devise '3.5.6'
NoMethodError (undefined method `to_datetime' for nil:NilClass):
activesupport (3.2.14) lib/active_support/core_ext/date_time/calculations.rb:141:in `<=>'
activesupport (3.2.14) lib/active_support/core_ext/time/calculations.rb:359:in `compare_with_coercion'
activesupport (3.2.14) lib/active_support/time_with_zone.rb:190:in `<=>'
activerecord (3.2.14) lib/active_record/attribute_methods/dirty.rb:90:in `=='
activerecord (3.2.14) lib/active_record/attribute_methods/dirty.rb:90:in `!='
activerecord (3.2.14) lib/active_record/attribute_methods/dirty.rb:90:in `_field_changed?'
activerecord (3.2.14) lib/active_record/attribute_methods/serialization.rb:97:in `_field_changed?'
activerecord (3.2.14) lib/active_record/attribute_methods/dirty.rb:63:in `write_attribute'
activerecord (3.2.14) lib/active_record/attribute_methods/time_zone_conversion.rb:47:in `reset_password_sent_at='
devise (3.5.6) lib/devise/models/recoverable.rb:94:in `clear_reset_password_token'
devise (3.5.6) lib/devise/models/recoverable.rb:32:in `block (2 levels) in <module:Recoverable>'
activesupport (3.2.14) lib/active_support/callbacks.rb:407:in `_run__312818332643827378__update__4267586685858662397__callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_update_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
activerecord (3.2.14) lib/active_record/callbacks.rb:272:in `update'
activerecord (3.2.14) lib/active_record/persistence.rb:348:in `create_or_update'
activerecord (3.2.14) lib/active_record/callbacks.rb:264:in `block in create_or_update'
activesupport (3.2.14) lib/active_support/callbacks.rb:414:in `_run__312818332643827378__save__4267586685858662397__callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
activerecord (3.2.14) lib/active_record/callbacks.rb:264:in `create_or_update'
activerecord (3.2.14) lib/active_record/persistence.rb:84:in `save'
activerecord (3.2.14) lib/active_record/validations.rb:50:in `save'
activerecord (3.2.14) lib/active_record/attribute_methods/dirty.rb:22:in `save'
activerecord (3.2.14) lib/active_record/transactions.rb:259:in `block (2 levels) in save'
activerecord (3.2.14) lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
activerecord (3.2.14) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
activerecord (3.2.14) lib/active_record/transactions.rb:208:in `transaction'
activerecord (3.2.14) lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
activerecord (3.2.14) lib/active_record/transactions.rb:259:in `block in save'
activerecord (3.2.14) lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
activerecord (3.2.14) lib/active_record/transactions.rb:258:in `save'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/active_record_helper.rb:26:in `block in save'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/transaction.rb:848:in `with_database_metric_name'
newrelic_rpm (3.15.0.314) lib/new_relic/agent.rb:572:in `with_database_metric_name'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/active_record_helper.rb:25:in `save'
devise (3.5.6) lib/devise/models/recoverable.rb:48:in `reset_password'
devise (3.5.6) lib/devise/models/recoverable.rb:141:in `reset_password_by_token'
devise (3.5.6) app/controllers/devise/passwords_controller.rb:32:in `update'
actionpack (3.2.14) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.14) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.14) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.14) lib/active_support/callbacks.rb:447:in `_run__1749634817633484351__process_action__1911466050157971041__callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.14) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.14) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.14) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.14) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.14) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:30:in `block in process_action'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:362:in `perform_action_with_newrelic_trace'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:25:in `process_action'
actionpack (3.2.14) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.14) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.14) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.14) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.14) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:36:in `call'
actionpack (3.2.14) lib/action_dispatch/routing/mapper.rb:43: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.14) lib/action_dispatch/routing/route_set.rb:608:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/rack/browser_monitoring.rb:32:in `traced_call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/rack/developer_mode.rb:48:in `traced_call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.4.7) lib/rack/etag.rb:23:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.4.7) lib/rack/conditionalget.rb:35:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/head.rb:14:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/flash.rb:242:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.4.7) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.7) lib/rack/session/abstract/id.rb:205:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/cookies.rb:341:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
activerecord (3.2.14) lib/active_record/query_cache.rb:64:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
activerecord (3.2.14) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `_run__349007920982004187__call__4267586685858662397__callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.14) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/reloader.rb:65:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
railties (3.2.14) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.14) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.14) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.14) lib/rails/rack/logger.rb:16:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/request_id.rb:22:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.4.7) lib/rack/methodoverride.rb:21:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.4.7) lib/rack/runtime.rb:17:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
activesupport (3.2.14) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.4.7) lib/rack/lock.rb:15:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/static.rb:63:in `call'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
railties (3.2.14) lib/rails/engine.rb:484:in `call'
railties (3.2.14) lib/rails/application.rb:231:in `call'
railties (3.2.14) lib/rails/railtie/configurable.rb:30:in `method_missing'
newrelic_rpm (3.15.0.314) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.4.7) lib/rack/content_length.rb:14:in `call'
railties (3.2.14) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.7) lib/rack/handler/webrick.rb:59:in `service'
/Users/uriklar/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
/Users/uriklar/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
/Users/uriklar/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
Rendered /Users/uriklar/.rvm/gems/ruby-2.3.0/gems/actionpack-3.2.14/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.1ms)
Rendered /Users/uriklar/.rvm/gems/ruby-2.3.0/gems/actionpack-3.2.14/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.9ms)
Rendered /Users/uriklar/.rvm/gems/ruby-2.3.0/gems/actionpack-3.2.14/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (50.4ms)
^[[1;2D
Ok, so apparently it was something to do either with:
I was using letter_opener, so password reset email wasn't actually being sent
Time wan't set correctly on my dev machine
I am finding a similar issue, where my "RAILS_ENV=development bundle exec rake db:drop db:create db:migrate db:seed" command works will with ruby 2.2.3p173, but with ruby 2.3.0p0, it throws the following error:
rake aborted!
NoMethodError: undefined method `to_datetime' for nil:NilClass
.../.rvm/gems/ruby-2.3.0#atlantis/gems/activesupport-3.2.17/lib/active_support/core_ext/date_time/calculations.rb:141:in `<=>'
Update:
I think I finally solved it.. I had the following code in my Active Admin Initializer file:
module ActiveAdmin
class BaseController
with_role :admin
end
end
Removing this piece of code seems to fix the problem.
I'm setting up a new Rails 4 app, where I've just installed Active Admin on (gem 'activeadmin', github: 'gregbell/active_admin').
I can create new records from the rails console, but whenever I try to create a new record or update one within Active Admin I get the following error, which I can't seem to get my head around. Anyone who can point me in the right direction.
12:06:59 web.1 | Started GET "/admin/teams/new" for 127.0.0.1 at 2013-10-31 12:06:59 +0100
12:06:59 web.1 | Processing by Admin::TeamsController#new as HTML
12:06:59 web.1 | AdminUser Load (0.7ms) SELECT "admin_users".* FROM "admin_users" WHERE "admin_users"."id" = 1 ORDER BY "admin_users"."id" ASC LIMIT 1
12:06:59 web.1 | Completed 500 Internal Server Error in 2ms
12:06:59 web.1 |
12:06:59 web.1 | ArgumentError (wrong number of arguments (2 for 0..1)):
and this is the stack trace:
activerecord (4.0.0) lib/active_record/core.rb:180:in `initialize'
activerecord (4.0.0) lib/active_record/inheritance.rb:27:in `new'
activerecord (4.0.0) lib/active_record/inheritance.rb:27:in `new'
/Users/KennethSkou/.rvm/gems/ruby-2.0.0-p247#Todo/bundler/gems/active_admin-0f663e3ad728/lib/active_admin/resource_controller/data_access.rb:142:in `build_new_resource'
/Users/KennethSkou/.rvm/gems/ruby-2.0.0-p247#Todo/bundler/gems/active_admin-0f663e3ad728/lib/active_admin/resource_controller/data_access.rb:129:in `build_resource'
inherited_resources (1.4.1) lib/inherited_resources/actions.rb:19:in `new'
actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.0.0) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (4.0.0) lib/active_support/callbacks.rb:443:in `_run__3851194588154266790__process_action__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.0) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.0) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:655:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.0) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
activerecord (4.0.0) lib/active_record/migration.rb:369:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__307601885218201832__call__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
railties (4.0.0) lib/rails/engine.rb:511:in `call'
railties (4.0.0) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
thin (1.6.0) lib/thin/connection.rb:82:in `block in pre_process'
thin (1.6.0) lib/thin/connection.rb:80:in `catch'
thin (1.6.0) lib/thin/connection.rb:80:in `pre_process'
thin (1.6.0) lib/thin/connection.rb:55:in `process'
thin (1.6.0) lib/thin/connection.rb:41:in `receive_data'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run_machine'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
thin (1.6.0) lib/thin/backends/base.rb:73:in `start'
thin (1.6.0) lib/thin/server.rb:162:in `start'
rack (1.5.2) lib/rack/handler/thin.rb:16:in `run'
rack (1.5.2) lib/rack/server.rb:264:in `start'
railties (4.0.0) lib/rails/commands/server.rb:84:in `start'
railties (4.0.0) lib/rails/commands.rb:78:in `block in <top (required)>'
railties (4.0.0) lib/rails/commands.rb:73:in `tap'
railties (4.0.0) lib/rails/commands.rb:73:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
My App/Admin/Team.rb file
ActiveAdmin.register Team do
def permitted_params
params.permit!
end
end
i am trying the PayPal REST API for Ruby on Rails, i am following the example "OAuth Request / Response" from https://developer.paypal.com/webapps/developer/docs/api/ for Ruby:
class PaymentsController < ApplicationController
include PayPal::SDK::REST
def pay
#api = PayPal::SDK::REST.set_config(
:ssl_options => {}, # Set ssl options
:mode => :sandbox, # Set :sandbox or :live
:client_id => "XXXXXXXXXXX",
:client_secret => "XXXXXXXXXXX" )
#api.token
end
end
And i don't know why, but i receive the next error.
LoadError in PaymentsController#pay
no such file to load -- {"scope":"openid https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card/.* https://api.paypal.com/v1/vault/credit-card https://api.paypal.com/v1/developer/.*","access_token":"Mnlhn0RcJ9KWQTU6z5-cH5iDu8aeMzOM7TACw1NhFp0","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":28800}
full trace
activesupport (3.0.20) lib/active_support/dependencies.rb:236:in `load'
activesupport (3.0.20) lib/active_support/dependencies.rb:236:in `block in load'
activesupport (3.0.20) lib/active_support/dependencies.rb:225:in `block in load_dependency'
activesupport (3.0.20) lib/active_support/dependencies.rb:597:in `new_constants_in'
activesupport (3.0.20) lib/active_support/dependencies.rb:225:in `load_dependency'
activesupport (3.0.20) lib/active_support/dependencies.rb:236:in `load'
paypal-sdk-core (0.2.6) lib/paypal-sdk/core/api/rest.rb:58:in `token_hash'
paypal-sdk-core (0.2.6) lib/paypal-sdk/core/api/rest.rb:65:in `token'
app/controllers/payments_controller.rb:15:in `pay'
actionpack (3.0.20) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.0.20) lib/abstract_controller/base.rb:150:in `process_action'
actionpack (3.0.20) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.20) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.0.20) lib/active_support/callbacks.rb:456:in `_run__1063560453__process_action__391973748__callbacks'
activesupport (3.0.20) lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
activesupport (3.0.20) lib/active_support/callbacks.rb:94:in `run_callbacks'
actionpack (3.0.20) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.20) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.20) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.0.20) lib/active_support/notifications.rb:52:in `block in instrument'
activesupport (3.0.20) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.20) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.20) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
newrelic_rpm (3.5.6.55) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:34:in `block in process_action'
newrelic_rpm (3.5.6.55) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:268:in `block in perform_action_with_newrelic_trace'
newrelic_rpm (3.5.6.55) lib/new_relic/agent/method_tracer.rb:240:in `trace_execution_scoped'
newrelic_rpm (3.5.6.55) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:263:in `perform_action_with_newrelic_trace'
newrelic_rpm (3.5.6.55) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:33:in `process_action'
actionpack (3.0.20) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.20) lib/abstract_controller/rendering.rb:41:in `process'
actionpack (3.0.20) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.20) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.20) lib/action_controller/metal.rb:178:in `block in action'
actionpack (3.0.20) lib/action_dispatch/routing/route_set.rb:68:in `call'
actionpack (3.0.20) lib/action_dispatch/routing/route_set.rb:68:in `dispatch'
actionpack (3.0.20) lib/action_dispatch/routing/route_set.rb:33:in `call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `block in recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:68:in `optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.20) lib/action_dispatch/routing/route_set.rb:499:in `call'
oink (0.9.3) lib/oink/middleware.rb:17:in `call'
newrelic_rpm (3.5.6.55) lib/new_relic/rack/error_collector.rb:8:in `call'
newrelic_rpm (3.5.6.55) lib/new_relic/rack/agent_hooks.rb:14:in `call'
newrelic_rpm (3.5.6.55) lib/new_relic/rack/browser_monitoring.rb:12:in `call'
newrelic_rpm (3.5.6.55) lib/new_relic/rack/developer_mode.rb:24:in `call'
warden (1.0.6) lib/warden/manager.rb:35:in `block in call'
warden (1.0.6) lib/warden/manager.rb:34:in `catch'
warden (1.0.6) lib/warden/manager.rb:34:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.7) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/cookies.rb:302:in `call'
activerecord (3.0.20) lib/active_record/query_cache.rb:32:in `block in call'
activerecord (3.0.20) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.20) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.20) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.20) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
activesupport (3.0.20) lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
actionpack (3.0.20) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.7) lib/rack/sendfile.rb:106:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.0.20) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.7) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.20) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.7) lib/rack/lock.rb:13:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.7) lib/rack/lock.rb:13:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/static.rb:30:in `call'
airbrake (3.1.6) lib/airbrake/rack.rb:41:in `call'
airbrake (3.1.6) lib/airbrake/user_informer.rb:12:in `call'
railties (3.0.20) lib/rails/application.rb:168:in `call'
railties (3.0.20) lib/rails/application.rb:77:in `method_missing'
railties (3.0.20) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.7) lib/rack/content_length.rb:13:in `call'
rack (1.2.7) lib/rack/handler/webrick.rb:52:in `service'
/home/jorge/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/home/jorge/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/home/jorge/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
This error occurred while loading the following files:
{"scope":"openid https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card/.* https://api.paypal.com/v1/vault/credit-card https://api.paypal.com/v1/developer/.*","access_token":"Mnlhn0RcJ9KWQTU6z5-cH5iDu8aeMzOM7TACw1NhFp0","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":28800}
SOLVED: update the multi_json gem to last version.
update the multi_json gem to last version.
My website has been up and running for a while on engineyard. Today, all of a sudden, I have been getting this error. This continuosly occured for about 5 to 10 minutes and then seems ok now. Any idea what causes this ? Also, any suggested cleanup or settings ? As such, there is no unusual activity on the website.
A Timeout::Error occurred in home#index:
Timeout::Error
/usr/lib/ruby/1.9.1/net/protocol.rb:140:in `rescue in rbuf_fill'
Backtrace:
/usr/lib/ruby/1.9.1/net/protocol.rb:140:in `rescue in rbuf_fill'
/usr/lib/ruby/1.9.1/net/protocol.rb:134:in `rbuf_fill'
/usr/lib/ruby/1.9.1/net/protocol.rb:116:in `readuntil'
/usr/lib/ruby/1.9.1/net/protocol.rb:126:in `readline'
/usr/lib/ruby/1.9.1/net/http.rb:2219:in `read_status_line'
/usr/lib/ruby/1.9.1/net/http.rb:2208:in `read_new'
/usr/lib/ruby/1.9.1/net/http.rb:1191:in `transport_request'
/usr/lib/ruby/1.9.1/net/http.rb:1177:in `request'
rest-client (1.6.7) lib/restclient/net_http_ext.rb:51:in `request'
newrelic_rpm (3.4.2.1) lib/new_relic/agent/instrumentation/net.rb:22:in `block in request_with_newrelic_trace'
newrelic_rpm (3.4.2.1) lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
newrelic_rpm (3.4.2.1) lib/new_relic/agent/instrumentation/net.rb:21:in `request_with_newrelic_trace'
/usr/lib/ruby/1.9.1/net/http.rb:1170:in `block in request'
/usr/lib/ruby/1.9.1/net/http.rb:627:in `start'
/usr/lib/ruby/1.9.1/net/http.rb:1168:in `request'
rest-client (1.6.7) lib/restclient/net_http_ext.rb:51:in `request'
newrelic_rpm (3.4.2.1) lib/new_relic/agent/instrumentation/net.rb:22:in `block in request_with_newrelic_trace'
newrelic_rpm (3.4.2.1) lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
newrelic_rpm (3.4.2.1) lib/new_relic/agent/instrumentation/net.rb:21:in `request_with_newrelic_trace'
/data/webinterface/shared/bundled_gems/ruby/1.9.1/bundler/gems/api_client-b950641bfce6/lib/api_client/api.rb:15:in `get'
/data/webinterface/shared/bundled_gems/ruby/1.9.1/bundler/gems/api_client-b950641bfce6/lib/api_client/show.rb:15:in `recommended'
app/controllers/application_controller.rb:229:in `set_public_home_page_params'
app/controllers/home_controller.rb:14: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:469:in `_run__141284936__process_action__119629849__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.4.2.1) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:34:in `block in process_action'
newrelic_rpm (3.4.2.1) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:268:in `block in perform_action_with_newrelic_trace'
newrelic_rpm (3.4.2.1) lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
newrelic_rpm (3.4.2.1) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:263:in `perform_action_with_newrelic_trace'
newrelic_rpm (3.4.2.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'
omniauth (1.1.1) lib/omniauth/strategy.rb:177:in `call!'
omniauth (1.1.1) lib/omniauth/strategy.rb:157:in `call'
omniauth (1.1.1) lib/omniauth/strategy.rb:177:in `call!'
omniauth (1.1.1) lib/omniauth/strategy.rb:157:in `call'
omniauth (1.1.1) lib/omniauth/builder.rb:48:in `call'
/data/webinterface/shared/bundled_gems/ruby/1.9.1/bundler/gems/exception_notification-192a49a02d63/lib/exception_notifier.rb:19: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'
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__857894770__call__169073287__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'
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'
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'
/usr/libexec/passenger/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
/usr/libexec/passenger/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
/usr/libexec/passenger/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/usr/libexec/passenger/lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
/usr/libexec/passenger/lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
/usr/libexec/passenger/lib/phusion_passenger/utils.rb:479:in `safe_fork'
/usr/libexec/passenger/lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
/usr/libexec/passenger/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/libexec/passenger/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/libexec/passenger/lib/phusion_passenger/abstract_server.rb:180:in `start'
/usr/libexec/passenger/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
/usr/libexec/passenger/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
/usr/libexec/passenger/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/usr/libexec/passenger/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
/usr/libexec/passenger/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
/usr/libexec/passenger/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/usr/libexec/passenger/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
/usr/libexec/passenger/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
/usr/libexec/passenger/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/usr/libexec/passenger/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/libexec/passenger/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/libexec/passenger/bin/passenger-spawn-server:101:in `<main>'
My bad. The reason for this was because I had introduced a sleep for a few minutes in one of the controllers as I wanted a delayed execution. I think this caused the problem
In my app, Users and Conversations are tied through a has_many :through relationship, the association table being conversation_users.
How do I delete an association (a User leaves the Conversation) from the Conversations controller? I tried:
def destroy_assoc
Conversation.find(params[:id]).conversation_users.find_by_user_id(current_user.id).destroy
redirect_to :back
end
But I got a undefined method 'eq' for nil:NilClass error. Here is the log when I call that action:
Processing by ConversationsController#destroy_assoc as HTML
Parameters: {"authenticity_token"=>"8AT1wx5MUVz1Gsqpp+u+z0vk8uj4F0mAWz5wpn+CjCU=", "username"=>"albert", "id"=>"14"}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 8 LIMIT 1
Conversation Load (0.2ms) SELECT "conversations".* FROM "conversations" WHERE "conversations"."id" = 14 LIMIT 1
ConversationUser Load (0.2ms) SELECT "conversation_users".* FROM "conversation_users" WHERE "conversation_users"."user_id" = 8 AND ("conversation_users".conversation_id = 14) LIMIT 1
Completed 500 Internal Server Error in 109ms
NoMethodError (undefined method 'eq' for nil:NilClass):
app/controllers/conversations_controller.rb:34:in `destroy_assoc'
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.9/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.9/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (7.1ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.9/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (12.9ms)
The record is found, but destroy raises an error. What am I doing wrong?
Thanks.
Full stack trace:
activesupport (3.0.9) lib/active_support/whiny_nil.rb:48:in `method_missing'
activerecord (3.0.9) lib/active_record/persistence.rb:83:in `destroy'
activerecord (3.0.9) lib/active_record/locking/optimistic.rb:110:in `destroy'
activerecord (3.0.9) lib/active_record/callbacks.rb:256:in `destroy'
activesupport (3.0.9) lib/active_support/callbacks.rb:414:in `_run_destroy_callbacks'
activerecord (3.0.9) lib/active_record/callbacks.rb:256:in `destroy'
activerecord (3.0.9) lib/active_record/transactions.rb:235:in `destroy'
activerecord (3.0.9) lib/active_record/transactions.rb:292:in `with_transaction_returning_status'
activerecord (3.0.9) lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
activerecord (3.0.9) lib/active_record/transactions.rb:207:in `transaction'
activerecord (3.0.9) lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
activerecord (3.0.9) lib/active_record/transactions.rb:235:in `destroy'
app/controllers/conversations_controller.rb:34:in `destroy_assoc'
actionpack (3.0.9) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.0.9) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.0.9) lib/abstract_controller/base.rb:150:in `process_action'
actionpack (3.0.9) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.9) lib/abstract_controller/callbacks.rb:18:in `process_action'
activesupport (3.0.9) lib/active_support/callbacks.rb:441:in `_run__2060746170__process_action__2040097307__callbacks'
activesupport (3.0.9) lib/active_support/callbacks.rb:410:in `send'
activesupport (3.0.9) lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
activesupport (3.0.9) lib/active_support/callbacks.rb:94:in `send'
activesupport (3.0.9) lib/active_support/callbacks.rb:94:in `run_callbacks'
actionpack (3.0.9) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.9) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
activesupport (3.0.9) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.9) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.9) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.9) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.9) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.9) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.9) lib/abstract_controller/rendering.rb:41:in `process'
actionpack (3.0.9) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.9) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.9) lib/action_controller/metal.rb:178:in `action'
actionpack (3.0.9) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.9) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.9) lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:82:in `optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.9) lib/action_dispatch/routing/route_set.rb:493:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.3) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/cookies.rb:302:in `call'
activerecord (3.0.9) lib/active_record/query_cache.rb:32:in `call'
activerecord (3.0.9) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.9) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.9) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.9) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/callbacks.rb:46:in `call'
activesupport (3.0.9) lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
actionpack (3.0.9) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.3) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.0.9) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.3) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.9) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.3) lib/rack/lock.rb:11:in `call'
rack (1.2.3) lib/rack/lock.rb:11:in `synchronize'
rack (1.2.3) lib/rack/lock.rb:11:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.9) lib/rails/application.rb:168:in `call'
railties (3.0.9) lib/rails/application.rb:77:in `send'
railties (3.0.9) lib/rails/application.rb:77:in `method_missing'
railties (3.0.9) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.3) lib/rack/content_length.rb:13:in `call'
rack (1.2.3) lib/rack/handler/webrick.rb:52:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.2.3) lib/rack/handler/webrick.rb:13:in `run'
rack (1.2.3) lib/rack/server.rb:217:in `start'
railties (3.0.9) lib/rails/commands/server.rb:65:in `start'
railties (3.0.9) lib/rails/commands.rb:30
railties (3.0.9) lib/rails/commands.rb:27:in `tap'
railties (3.0.9) lib/rails/commands.rb:27
script/rails:6:in `require'
script/rails:6
Check the answer to this question:
undefined method `eq' for nil:NilClass with rails 3 and ruby enterprise on ubuntu hardy
If you have no ID field in your association class, it can't be treated as a model, it appears. Are you using a a :has_and_belongs_to_many association with a join table without a primary key id?
What about
#conversation = current_user.conversation_users.find_by_conversation_id(params[:id])
#conversation.destroy
I guess
User has_many :conversation_users
User has_many :conversations :through => :conversation_users
Does that work? I think it's a cleaner approach at least, letting AR do the job.