rails: NoMethodError: undefined method `reverse' for nil:NilClass
Hi, getting this error randomly, but always on <<
for has_many/:through associations. This happens randomly and I can’t reproduce this issue by repeating the failed operation.
Please tell me if I can provide some more information.
Backtrace:
2012-09-05 11:40:22 : NoMethodError: undefined method `reverse' for nil:NilClass
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:10:in `block in to_sql'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/arel-2.2.3/lib/arel/visitors/bind_visitor.rb:17:in `call'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/arel-2.2.3/lib/arel/visitors/bind_visitor.rb:17:in `visit_Arel_Nodes_BindParam'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/arel-2.2.3/lib/arel/visitors/visitor.rb:19:in `visit'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/arel-2.2.3/lib/arel/visitors/to_sql.rb:119:in `block in visit_Arel_Nodes_Values'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/arel-2.2.3/lib/arel/visitors/to_sql.rb:117:in `map'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/arel-2.2.3/lib/arel/visitors/to_sql.rb:117:in `visit_Arel_Nodes_Values'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/arel-2.2.3/lib/arel/visitors/visitor.rb:19:in `visit'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/arel-2.2.3/lib/arel/visitors/to_sql.rb:82:in `visit_Arel_Nodes_InsertStatement'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/arel-2.2.3/lib/arel/visitors/visitor.rb:19:in `visit'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/arel-2.2.3/lib/arel/visitors/visitor.rb:5:in `accept'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/arel-2.2.3/lib/arel/visitors/to_sql.rb:18:in `block in accept'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:185:in `with_connection'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/arel-2.2.3/lib/arel/visitors/to_sql.rb:16:in `accept'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/arel-2.2.3/lib/arel/visitors/bind_visitor.rb:11:in `accept'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:9:in `to_sql'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:91:in `insert'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/relation.rb:70:in `insert'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/persistence.rb:313:in `create'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/timestamp.rb:51:in `create'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/callbacks.rb:268:in `block in create'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.8/lib/active_support/callbacks.rb:417:in `_run_create_callbacks'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/callbacks.rb:268:in `create'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/persistence.rb:294:in `create_or_update'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/callbacks.rb:264:in `block in create_or_update'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.8/lib/active_support/callbacks.rb:417:in `_run_save_callbacks'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/callbacks.rb:264:in `create_or_update'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/persistence.rb:37:in `save'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/validations.rb:50:in `save'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/attribute_methods/dirty.rb:22:in `save'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:241:in `block (2 levels) in save'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:194:in `transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:208:in `transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:493:in `block in transaction_with_trace_ActiveRecord_self_name_transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:488:in `transaction_with_trace_ActiveRecord_self_name_transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:241:in `block in save'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:252:in `rollback_active_record_state!'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:240:in `save'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/has_many_association.rb:16:in `insert_record'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_association.rb:436:in `block (2 levels) in create_record'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_association.rb:344:in `add_to_target'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_association.rb:434:in `block in create_record'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_association.rb:147:in `block in transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:194:in `transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:208:in `transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:493:in `block in transaction_with_trace_ActiveRecord_self_name_transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:488:in `transaction_with_trace_ActiveRecord_self_name_transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_association.rb:146:in `transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_association.rb:433:in `create_record'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_association.rb:111:in `create'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_proxy.rb:53:in `create'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/acts_as_audited-2.0.0/lib/acts_as_audited/auditor.rb:218:in `write_audit'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/acts_as_audited-2.0.0/lib/acts_as_audited/auditor.rb:200:in `audit_create'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.8/lib/active_support/callbacks.rb:401:in `_run_create_callbacks'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/callbacks.rb:268:in `create'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/persistence.rb:294:in `create_or_update'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/callbacks.rb:264:in `block in create_or_update'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.8/lib/active_support/callbacks.rb:426:in `_run_save_callbacks'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/callbacks.rb:264:in `create_or_update'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/persistence.rb:37:in `save'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/validations.rb:50:in `save'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/attribute_methods/dirty.rb:22:in `save'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:241:in `block (2 levels) in save'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:194:in `transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:208:in `transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:493:in `block in transaction_with_trace_ActiveRecord_self_name_transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:488:in `transaction_with_trace_ActiveRecord_self_name_transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:241:in `block in save'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:252:in `rollback_active_record_state!'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:240:in `save'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/has_many_association.rb:16:in `insert_record'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_association.rb:128:in `block (3 levels) in concat'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_association.rb:344:in `add_to_target'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_association.rb:127:in `block (2 levels) in concat'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_association.rb:125:in `each'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_association.rb:125:in `block in concat'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_association.rb:147:in `block in transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:194:in `transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:208:in `transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:493:in `block in transaction_with_trace_ActiveRecord_self_name_transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:488:in `transaction_with_trace_ActiveRecord_self_name_transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_association.rb:146:in `transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_association.rb:124:in `concat'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/associations/collection_proxy.rb:124:in `<<'
/var/www/crm.wegohealth.com/releases/20120905103158/app/models/profile.rb:773:in `block in primary_address='
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:194:in `transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:208:in `transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:493:in `block in transaction_with_trace_ActiveRecord_self_name_transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.1/lib/new_relic/agent/method_tracer.rb:488:in `transaction_with_trace_ActiveRecord_self_name_transaction'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.8/lib/active_record/transactions.rb:232:in `transaction'
/var/www/crm.wegohealth.com/releases/20120905103158/app/models/profile.rb:762:in `primary_address='
/var/www/crm.wegohealth.com/releases/20120905103158/lib/import/merging_helpers.rb:150:in `merge_addresses'
/var/www/crm.wegohealth.com/releases/20120905103158/lib/import/profiles.rb:16:in `merge_profile'
/var/www/crm.wegohealth.com/releases/20120905103158/lib/import/profiles/xls.rb:162:in `block in process'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/spreadsheet-0.6.9/lib/spreadsheet/worksheet.rb:113:in `block in each'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/spreadsheet-0.6.9/lib/spreadsheet/worksheet.rb:112:in `upto'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/spreadsheet-0.6.9/lib/spreadsheet/worksheet.rb:112:in `each'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/gems/spreadsheet-0.6.9/lib/spreadsheet/excel/worksheet.rb:35:in `each'
/var/www/crm.wegohealth.com/releases/20120905103158/lib/import/profiles/xls.rb:130:in `process'
/var/www/crm.wegohealth.com/releases/20120905103158/lib/import/base.rb:53:in `perform'
/var/www/crm.wegohealth.com/releases/20120905103158/lib/import/profiles/xls.rb:119:in `perform'
/var/www/crm.wegohealth.com/releases/20120905103158/app/models/delayed_job.rb:193:in `block (2 levels) in perform'
/var/www/crm.wegohealth.com/shared/bundle/ruby/1.9.1/bundler/gems/sunspot_index_queue-a2b39e3ce810/lib/sunspot/index_queue.rb:26:in `set_priority'
/var/www/crm.wegohealth.com/releases/20120905103158/app/models/delayed_job.rb:192:in `block in perform'
About this issue
- Original URL
- State: closed
- Created 12 years ago
- Comments: 31 (13 by maintainers)
Commits related to this issue
- Fix regression on `.select_*` methods. This was a common pattern: ``` query = author.posts.select(:title) connection.select_one(query) ``` However `.select` returns a ActiveRecord::AssociationRelati... — committed to arthurnn/rails by arthurnn 10 years ago
- trying to fix issue when interacting with your_platform. On some occasions, this error has been raised: NoMethodError: undefined method `reverse' for nil:NilClass. This issue might be related: h... — committed to fiedl/temporal_scopes by fiedl 10 years ago
I just ran into this, too, with Rails 3.2.13 and query_reviewer 0.1.8. Error is resolved by removing query_reviewer gem.