diff options
author | claudiob <claudiob@inventati.org> | 2016-08-15 14:12:08 -0700 |
---|---|---|
committer | claudiob <claudiob@inventati.org> | 2016-08-15 14:12:08 -0700 |
commit | bb4886684ec317961dd199f1889e1b229801a388 (patch) | |
tree | b2a24db738d381c46989a581723ba70f5b308087 /activesupport/lib/active_support/benchmarkable.rb | |
parent | c8d9a11df20c1ab238646012318ecb93ca3629d5 (diff) | |
download | rails-bb4886684ec317961dd199f1889e1b229801a388.tar.gz rails-bb4886684ec317961dd199f1889e1b229801a388.tar.bz2 rails-bb4886684ec317961dd199f1889e1b229801a388.zip |
Eager autoload ActiveRecord::TableMetadata
Fixes a bug that can occur when ActiveJob tries to access ActiveRecord.
Specifically, I had an Active Job process fail on Sidekiq with this error:
```
ActiveJob::DeserializationError: Error while trying to deserialize arguments:
uninitialized constant ActiveRecord::Core::ClassMethods::TableMetadata
Did you mean? ActiveRecord::TableMetadata
```
raised by these lines of code:
```
[GEM_ROOT]/gems/activerecord-5.0.0.1/lib/active_record/core.rb:300 :in `table_metadata`
298
299 def table_metadata # :nodoc:
300 TableMetadata.new(self, arel_table)
301 end
302 end
[GEM_ROOT]/gems/activerecord-5.0.0.1/lib/active_record/core.rb:273 :in `predicate_builder`
[GEM_ROOT]/gems/activerecord-5.0.0.1/lib/active_record/core.rb:290 :in `relation`
```
The problem seems to be that, inside ActiveRecord::Core, the `TableMetadata`
class has not been loaded and, therefore, Rails tries to access the constant
`ActiveRecord::Core::ClassMethods::TableMetadata` which does not exist.
Eager loading `ActiveRecord::TableMetadata` should fix the issue.
@rafaelfranca -- see our Campfire discussion
Diffstat (limited to 'activesupport/lib/active_support/benchmarkable.rb')
0 files changed, 0 insertions, 0 deletions