diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-01-23 04:28:29 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-01-23 05:23:32 +0900 |
commit | 7ca3ab415d409ba39b07ff5a96da06d68098069b (patch) | |
tree | cb50749844fa959353f92f88124a3f4e1967c351 /activerecord/lib/active_record/associations/through_association.rb | |
parent | c177bca26cbc08f8dfb1e3a68613a89e6a035783 (diff) | |
download | rails-7ca3ab415d409ba39b07ff5a96da06d68098069b.tar.gz rails-7ca3ab415d409ba39b07ff5a96da06d68098069b.tar.bz2 rails-7ca3ab415d409ba39b07ff5a96da06d68098069b.zip |
Fix building has_one through record
Fixes #31762.
Diffstat (limited to 'activerecord/lib/active_record/associations/through_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/through_association.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/through_association.rb b/activerecord/lib/active_record/associations/through_association.rb index 54673b74f7..5afb0bc068 100644 --- a/activerecord/lib/active_record/associations/through_association.rb +++ b/activerecord/lib/active_record/associations/through_association.rb @@ -19,6 +19,10 @@ module ActiveRecord end end + def through_association + @through_association ||= owner.association(through_reflection.name) + end + # We merge in these scopes for two reasons: # # 1. To get the default_scope conditions for any of the other reflections in the chain |