Receiving undefined method `captures' for nil:NilClass
khoi74 opened this issue · 2 comments
I've been trying to dig into what's happening, but I'm at a road block. Any help would be greatly appreciated!
I'm appending and saving multiple email objects, which have two attributes utilizing the string_array data type, to a has_many relationship.
This is the stack trace:
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-postgres-array-0.0.6/lib/activerecord-postgres-array/string.rb:23:in from_postgres_array' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.3/lib/active_support/multibyte/chars.rb:59:in
method_missing'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/attribute_methods/read.rb:82:in __temp__' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/attribute_methods/read.rb:46:in
type_cast_attribute'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/attribute_methods/read.rb:126:in read_attribute' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-postgres-array-0.0.6/lib/activerecord-postgres-array/activerecord.rb:16:in
block in arel_attributes_values'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-postgres-array-0.0.6/lib/activerecord-postgres-array/activerecord.rb:13:in each' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-postgres-array-0.0.6/lib/activerecord-postgres-array/activerecord.rb:13:in
arel_attributes_values'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/persistence.rb:361:in create' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/timestamp.rb:57:in
create'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/callbacks.rb:268:in block in create' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:403:in
_run__857705358352641404__create__3650861947297733372__callbacks'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in __run_callback' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:385:in
_run_create_callbacks'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:81:in run_callbacks' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/callbacks.rb:268:in
create'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/persistence.rb:344:in create_or_update' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/callbacks.rb:264:in
block in create_or_update'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:414:in _run__857705358352641404__save__3650861947297733372__callbacks' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in
__run_callback'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:385:in _run_save_callbacks' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:81:in
run_callbacks'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/callbacks.rb:264:in create_or_update' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/persistence.rb:84:in
save'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/validations.rb:50:in save' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/attribute_methods/dirty.rb:22:in
save'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/transactions.rb:241:in block (2 levels) in save' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/transactions.rb:295:in
block in with_transaction_returning_status'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in transaction' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/transactions.rb:208:in
transaction'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/transactions.rb:293:in with_transaction_returning_status' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/transactions.rb:241:in
block in save'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/transactions.rb:252:in rollback_active_record_state!' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/transactions.rb:240:in
save'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/associations/has_many_association.rb:16:in insert_record' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/associations/collection_association.rb:492:in
block (2 levels) in concat_records'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/associations/collection_association.rb:342:in add_to_target' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/associations/collection_association.rb:491:in
block in concat_records'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/associations/collection_association.rb:489:in each' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/associations/collection_association.rb:489:in
concat_records'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/associations/collection_association.rb:134:in block in concat' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/associations/collection_association.rb:149:in
block in transaction'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in transaction' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/transactions.rb:208:in
transaction'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/associations/collection_association.rb:148:in transaction' /Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/associations/collection_association.rb:134:in
concat'
/Users/davidkpham/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.3/lib/active_record/associations/collection_proxy.rb:116:in <<' /Users/davidkpham/Dropbox/Spectacle/Product/Code/Web application/mosec/app/models/email_account.rb:140:in
block (3 levels) in index_emails'
/Users/davidkpham/Dropbox/Spectacle/Product/Code/Web application/mosec/app/models/email_account.rb:130:in each' /Users/davidkpham/Dropbox/Spectacle/Product/Code/Web application/mosec/app/models/email_account.rb:130:in
block (2 levels) in index_emails'
/Users/davidkpham/Dropbox/Spectacle/Product/Code/Web application/mosec/app/models/email_account.rb:127:in each' /Users/davidkpham/Dropbox/Spectacle/Product/Code/Web application/mosec/app/models/email_account.rb:127:in
each_slice'
/Users/davidkpham/Dropbox/Spectacle/Product/Code/Web application/mosec/app/models/email_account.rb:127:in block in index_emails' /Users/davidkpham/Dropbox/Spectacle/Product/Code/Web application/mosec/app/models/email_account.rb:122:in
each'
/Users/davidkpham/Dropbox/Spectacle/Product/Code/Web application/mosec/app/models/email_account.rb:122:in index_emails' /Users/davidkpham/Dropbox/Spectacle/Product/Code/Web application/mosec/app/jobs/emails_synchronizer.rb:8:in
perform'
Can you explain your setup in more detail? I don't what "email objects" are supposed to be. Just give a sample setup to reproduce this error.
Furthermore, could you take a look at the database and tell us what values are in the array columns? It seems there is a value which does not contain curly braces and is also not empty, which blows up the from_postgres_array
.
Hi Fabian, thanks for looking into the issue and sorry for the delay in response. It was just an error on my part.