diff options
author | Edouard CHIN <edouard.chin@shopify.com> | 2019-07-22 15:27:17 +0200 |
---|---|---|
committer | Edouard CHIN <edouard.chin@shopify.com> | 2019-07-22 15:27:17 +0200 |
commit | 426d2f2502780635ca56c09a5aeb0829dd9212ee (patch) | |
tree | 4d913d38a0ac553d0c1974f378d8f50e593f8e53 /activerecord/lib/active_record/validations/associated.rb | |
parent | 9ad806887096be1f60019a6b301a4c84aa1d8e65 (diff) | |
download | rails-426d2f2502780635ca56c09a5aeb0829dd9212ee.tar.gz rails-426d2f2502780635ca56c09a5aeb0829dd9212ee.tar.bz2 rails-426d2f2502780635ca56c09a5aeb0829dd9212ee.zip |
Move the deprecation call after the new class has been defined:
- If we create the deprecation before the new class is defined this
creates an issue in case you use a `TracePoint`. The
`Tracepoint#return_value` will try to get the new class constant
resulting in a uninitialized constant Rails::SourceAnnotationExtractor
The problem can be reproduced like this:
```ruby
@defined = Set.new
ANONYMOUS_CLASS_DEFINITION_TRACEPOINT = TracePoint.new(:c_return) do |tp|
next unless @defined.add?(tp.return_value)
end
ANONYMOUS_CLASS_DEFINITION_TRACEPOINT.enable
require 'rails'
require "rails/source_annotation_extractor"
```
Diffstat (limited to 'activerecord/lib/active_record/validations/associated.rb')
0 files changed, 0 insertions, 0 deletions