aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-01-10 20:25:37 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-01-10 20:28:37 +0900
commit027f865fc8b262d9ba3ee51da3483e94a5489b66 (patch)
treefdac6eeb639beafed739ea9ddf1b940f9219233c /activerecord/lib/active_record/associations
parent7ccd070c91ae1089f307c8557dcbd9a14837316c (diff)
parent1813350f0927dde01a11ebbd33a8f6b0deacd073 (diff)
downloadrails-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.rb2
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