diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-01-10 20:25:37 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-01-10 20:28:37 +0900 |
commit | 027f865fc8b262d9ba3ee51da3483e94a5489b66 (patch) | |
tree | fdac6eeb639beafed739ea9ddf1b940f9219233c /activerecord/lib/active_record/associations | |
parent | 7ccd070c91ae1089f307c8557dcbd9a14837316c (diff) | |
parent | 1813350f0927dde01a11ebbd33a8f6b0deacd073 (diff) | |
download | rails-027f865fc8b262d9ba3ee51da3483e94a5489b66.tar.gz rails-027f865fc8b262d9ba3ee51da3483e94a5489b66.tar.bz2 rails-027f865fc8b262d9ba3ee51da3483e94a5489b66.zip |
Merge pull request #16314 from zoltankiss/allow-nested-has-many-associations-on-unpersisted-parent-instances
fix nested `has many :through` associations on unpersisted parent instances
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/through_association.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/through_association.rb b/activerecord/lib/active_record/associations/through_association.rb index 249eb1775b..806397f83a 100644 --- a/activerecord/lib/active_record/associations/through_association.rb +++ b/activerecord/lib/active_record/associations/through_association.rb @@ -68,7 +68,7 @@ module ActiveRecord end def foreign_key_present? - through_reflection.belongs_to? && !owner[through_reflection.foreign_key].nil? + through_reflection.belongs_to_or_through? && !owner[through_reflection.foreign_key].nil? end def ensure_mutable |