collectiveidea / audited

Audited (formerly acts_as_audited) is an ORM extension that logs all changes to your Rails models.
MIT License
3.37k stars 660 forks source link

undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer during deserialisation #289

Open Schwad opened 8 years ago

Schwad commented 8 years ago

I'm in the middle of upgrading a decent sized application to Rails 5, and audited is one of the gems we love and enjoy to use a fair bit.

With one of the objects I am running into the following error when we call associated_audits on it:

undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer

I've checked and followed all guidance here in general about upgrades, and have been flailing about on this issue long enough to come here.

Here is my stacktrace:

ArgumentError: undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/class_loader.rb:53:in `path2class'
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/class_loader.rb:53:in `resolve'
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/class_loader.rb:45:in `find'
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/class_loader.rb:27:in `load'
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:379:in `resolve_class'
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:207:in `visit_Psych_Nodes_Mapping'
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/visitor.rb:15:in `visit'
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/visitor.rb:5:in `accept'
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:31:in `accept'
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:321:in `block in revive_hash'
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:319:in `each'
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:319:in `each_slice'
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:319:in `revive_hash'
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:161:in `visit_Psych_Nodes_Mapping'
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/visitor.rb:15:in `visit'
    from /Users/my_user_name/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/visitor.rb:5:in `accept'
... 62 levels...
    from /Users/my_user_name/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/attribute_set.rb:42:in `fetch_value'
    from /Users/my_user_name/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/attribute_methods/read.rb:66:in `_read_attribute'
    from /Users/my_user_name/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/attribute_methods/read.rb:53:in `read_attribute'
    from /Users/my_user_name/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/attribute_methods.rb:297:in `attribute_for_inspect'
    from /Users/my_user_name/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/core.rb:485:in `block in inspect'
    from /Users/my_user_name/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/core.rb:483:in `collect'
    from /Users/my_user_name/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/core.rb:483:in `inspect'
    from /Users/my_user_name/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/relation.rb:683:in `map!'
    from /Users/my_user_name/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/relation.rb:683:in `inspect'
    from /Users/my_user_name/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
    from /Users/my_user_name/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
    from /Users/my_user_name/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
    from /Users/my_user_name/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
    from /Users/my_user_name/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
  from bin/rails:4:in `require'

The object runs a standard

audited
has_associated_audits

in the model file.

Would love to hear your feedback on what I'm missing here, also more than happy to provide any other supplementary info as needed. I'll have the window open for the next ten hours or so and should be quick to respond today and tomorrow.

danielmorrison commented 8 years ago

Oy, a yaml error. That's new to me and doesn't sound fun. Let's see if anyone can dig up a solution.

/cc @bryckbost

Schwad commented 8 years ago

@danielmorrison haha, I appreciate the commiseration. Normally, I try to avoid filing issues at all costs so maintainers don't get bogged down with riff raff, so, I promise I've done my best to honor due diligence before filing this! Also, since it's part of my Rails 5 saga on a 3 year old 7,000+ commit application, I figure hopefully once we resolve this it will help others who may head down this road in the future.

Thanks again.

Schwad commented 8 years ago

Still having the issue, will be pulling the object even further apart to find what change or at what point we are seeing associated_audits break.

danielmorrison commented 8 years ago

I'm hoping it is some specific YAML and not the general case. If you can figure out what record is causing the problems, then you can see if just trying to parse that YAML directly breaks it, which I expect it will.

kwent commented 8 years ago

@Schwad Yes copy the raw record using psql for example.

Schwad commented 7 years ago

I just overrode associated_audits and manually included the audits.

Schwad commented 7 years ago

Update, I tried printing out every existing audit in my console to see if I could find a slightly different error. I have. Here's the stacktrace, would love the outside opinions on this baby. @danielmorrison @kwent

ArgumentError: undefined class/module AttachmentNew
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/class_loader.rb:53:in `path2class'
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/class_loader.rb:53:in `resolve'
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/class_loader.rb:45:in `find'
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/class_loader.rb:27:in `load'
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:379:in `resolve_class'
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:207:in `visit_Psych_Nodes_Mapping'
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/visitor.rb:15:in `visit'
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/visitor.rb:5:in `accept'
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:31:in `accept'
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:321:in `block in revive_hash'
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:319:in `each'
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:319:in `each_slice'
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:319:in `revive_hash'
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:357:in `revive'
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:207:in `visit_Psych_Nodes_Mapping'
    from /Users/my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/psych/visitors/visitor.rb:15:in `visit'
... 25 levels...
    from /Users/my_username/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/attribute.rb:140:in `type_cast'
    from /Users/my_username/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/attribute.rb:38:in `value'
    from /Users/my_username/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/attribute_set.rb:42:in `fetch_value'
    from /Users/my_username/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/attribute_methods/read.rb:66:in `_read_attribute'
    from /Users/my_username/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/attribute_methods/read.rb:53:in `read_attribute'
    from /Users/my_username/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/attribute_methods.rb:297:in `attribute_for_inspect'
    from /Users/my_username/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/core.rb:485:in `block in inspect'
    from /Users/my_username/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/core.rb:483:in `collect'
    from /Users/my_username/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.1/lib/active_record/core.rb:483:in `inspect'
    from /Users/my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
    from /Users/my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
    from /Users/my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
    from /Users/my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
    from /Users/my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
    from bin/rails:9:in `require'
Schwad commented 7 years ago

Other info:

I ran through with a begin/rescue block, catching the errors into an array. Here's a smidgen of what I've received:

["undefined class/module AttachmentNew", "undefined class/module AttachmentNew", "undefined class/module AttachmentNew", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer", "undefined class/module PictureUploader::Uploader60135420", "undefined class/module PictureUploader::Uploader60135420", "undefined class/module PictureUploader::Uploader60135420", "undefined class/module PictureUploader::Uploader60135420", "undefined class/module PictureUploader::Uploader60135420", "undefined class/module PictureUploader::Uploader60135420"] 
danielmorrison commented 7 years ago

do you have an AttachmentNew model in your app? Did you at one time that audits were created for? If so, it would cause problems when trying to find that class now. If that's the case, your best way forward may be to delete the offending audits.

Schwad commented 7 years ago

I'm pursuing this route right now and will advise with progress in case anyone else in the future is running into this issue.

Rudiney commented 6 years ago

So im facing the same exception upgrading my app and i think see whats the problem...

I have this at audited_changes column:

---
aluno_presenca:
- !ruby/object:AlunoPresenca::AConfirmar
  owner: !ruby/object:Aula
    raw_attributes:
      conta_id: 2408
      aluno_id: '28697'
      aluno_presenca: presente
    attributes: !ruby/object:ActiveRecord::AttributeSet
      attributes: !ruby/object:ActiveRecord::LazyAttributeHash
        types:
          id: &1 !ruby/object:ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer
            precision:
            scale:
            limit:
            range: !ruby/range
              begin: -2147483648
              end: 2147483648
              excl: true
          conta_id: *1
          aluno_id: *1
...

And ActiveRecord 5.0 does not include ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer anymore... The parse tries to instantiate this object and BOOM.

Not sure why the entire object is serialized this way... You guys see a solution here besides deleting these audits?

tbrisker commented 6 years ago

@Rudiney Looks like this change was introduced in https://github.com/rails/rails/commit/aafee233fb3b4211ee0bfb1fca776c159bd1067e#diff-9746cff65c93d4bb623c108adc154b76 . I'm not sure about it, but it may be possible to fix with a migration changing !ruby/object:ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer to !ruby/object:ActiveModel::Type::Integer @Schwad - Did you ever find a way to fix this?

jeremywadsack commented 6 years ago

The change in rails broke Rails.cache serialization too... :(

Rudiney commented 6 years ago

@tbrisker sadly found no better solution than update/delete the records so far... I did consider defining ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer = ActiveModel::Type::Integer but it smells a lot and have no clue about the consequences.

Schwad commented 6 years ago

I am going to be honest with you guys... I opened this a year and a half ago and was at a point of desperation.

We had a forked version of the gem which had a couple small lines particular to us.... The only changes we made was adding a line to skip our few sparse "broken" records once we identified them and then the only other changes made in 2017 were bumps for Rails 5.1 compatibility.

It may be an ugly approach but we haven't had any trouble since....

Schwad commented 6 years ago

But I'm happy to be a part of this discussion now to hear what approaches you all are trying, difficulties you are finding and if we can knock this bug down once and for all.

jeremywadsack commented 6 years ago

Fortunately for us (for the cache issue), we had only cached two as ActiveRecord objects (which reference the PostgreSQL types) and they were easy to remove and have rebuilt. In general we try not to cache or serialize any complex types.

We are in the process of migrating to Rails 5 where we use audited but I don't see any data like this in our database.

select audited_changes from audits where audited_changes like '!ruby/object';
 audited_changes 
-----------------
(0 rows)

@Schwad @Rudiney Does this only happens if you are auditing changes on a model with serialized fields that you store ActiveRecord objects in?

Rudiney commented 6 years ago

@jeremywadsack here i obviously had something wrong at some edge case... The audited changes should not serialize any object. I could not find how ho reproduce this scenario as it happened in about ~0.5% of the cases and sadly seems to not happen anymore in the new audited version

Dig up some cases where the audit holds a change in an enumerable attribute but could not reproduce it. I'm dealing with a considerable large old app so anything could have happened.

My final approach here was to remove this specific changes from de database using a query just like that.

rsiddle commented 6 years ago

This may be related, I ran into the same issue when upgrading from Rails 4.2 to Rails 5. I solved the NameError: uninitialized constant ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer error by clearing the Rails cache on the production site.

Rails.cache.clear