Skip to content

Commit 7b96382

Browse files
committed
Let collect_deprecated_nested_reflections be private
This was protected because, at some point, the method was recursive, invoking itself on nested reflections. The final implementation, however, performs recursion indirectly via the public deprecated_nested_reflections.
1 parent 1688ba0 commit 7b96382

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

activerecord/lib/active_record/reflection.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,19 +1239,6 @@ def actual_source_reflection # FIXME: this is a horrible name
12391239
source_reflection.actual_source_reflection
12401240
end
12411241

1242-
def collect_deprecated_nested_reflections
1243-
result = []
1244-
[through_reflection, source_reflection].each do |reflection|
1245-
result << reflection if reflection.deprecated?
1246-
# Both the through and the source reflections could be through
1247-
# themselves. Nesting can go an arbitrary number of levels down.
1248-
if reflection.through_reflection?
1249-
result.concat(reflection.deprecated_nested_reflections)
1250-
end
1251-
end
1252-
result
1253-
end
1254-
12551242
private
12561243
attr_reader :delegate_reflection
12571244

@@ -1271,6 +1258,19 @@ def derive_class_name
12711258
options[:source_type] || source_reflection.class_name
12721259
end
12731260

1261+
def collect_deprecated_nested_reflections
1262+
result = []
1263+
[through_reflection, source_reflection].each do |reflection|
1264+
result << reflection if reflection.deprecated?
1265+
# Both the through and the source reflections could be through
1266+
# themselves. Nesting can go an arbitrary number of levels down.
1267+
if reflection.through_reflection?
1268+
result.concat(reflection.deprecated_nested_reflections)
1269+
end
1270+
end
1271+
result
1272+
end
1273+
12741274
delegate_methods = AssociationReflection.public_instance_methods -
12751275
public_instance_methods
12761276

0 commit comments

Comments
 (0)