aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/reflection.rb
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/reflection.rb
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/reflection.rb')
-rw-r--r--activerecord/lib/active_record/reflection.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index 9e32b69786..7b53f9c15c 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -504,6 +504,10 @@ module ActiveRecord
@association_scope_cache.clear
end
+ def belongs_to_or_through?
+ belongs_to?
+ end
+
def nested?
false
end
@@ -836,6 +840,10 @@ module ActiveRecord
source_reflection.join_scopes(table, predicate_builder) + super
end
+ def belongs_to_or_through?
+ through_reflection.belongs_to_or_through?
+ end
+
def has_scope?
scope || options[:source_type] ||
source_reflection.has_scope? ||