diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2019-04-11 17:51:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-11 17:51:11 -0400 |
commit | 644cd445c5dcef070302a5c6cd826f3a7d4a64e2 (patch) | |
tree | 58cf3d6ccc44607e8d850b932cc1aebb211cedd7 /activerecord/lib/active_record/reflection.rb | |
parent | d8ab7ef179a07e6858afbc580b6b516c0c4e8940 (diff) | |
parent | 314d66b5a14d20a84228ec0f59a897d491d43932 (diff) | |
download | rails-644cd445c5dcef070302a5c6cd826f3a7d4a64e2.tar.gz rails-644cd445c5dcef070302a5c6cd826f3a7d4a64e2.tar.bz2 rails-644cd445c5dcef070302a5c6cd826f3a7d4a64e2.zip |
Merge pull request #35921 from Shopify/deduplicate-activerecord-strings
Deduplicate Active Record reflection names
Diffstat (limited to 'activerecord/lib/active_record/reflection.rb')
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 3452cf971b..1312bf6f91 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -21,12 +21,12 @@ module ActiveRecord def add_reflection(ar, name, reflection) ar.clear_reflections_cache - name = name.to_s + name = -name.to_s ar._reflections = ar._reflections.except(name).merge!(name => reflection) end def add_aggregate_reflection(ar, name, reflection) - ar.aggregate_reflections = ar.aggregate_reflections.merge(name.to_s => reflection) + ar.aggregate_reflections = ar.aggregate_reflections.merge(-name.to_s => reflection) end private |