mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
adds some details to the rationale of converted_arrays [ci skip]
This commit is contained in:
parent
f712f89961
commit
f84d081faf
2 changed files with 5 additions and 1 deletions
|
@ -129,6 +129,10 @@ module ActionController
|
|||
# Attribute that keeps track of converted arrays, if any, to avoid double
|
||||
# looping in the common use case permit + mass-assignment. Defined in a
|
||||
# method to instantiate it only if needed.
|
||||
#
|
||||
# Testing membership still loops, but it's going to be faster than our own
|
||||
# loop that converts values. Also, we are not going to build a new array
|
||||
# object per fetch.
|
||||
def converted_arrays
|
||||
@converted_arrays ||= Set.new
|
||||
end
|
||||
|
|
|
@ -176,7 +176,7 @@ class ParametersPermitTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
# Strong params has an internal cache to avoid duplicated loops in the most
|
||||
# common usage pattern. See the docs of the method `coverted_array`.
|
||||
# common usage pattern. See the docs of the method `converted_arrays`.
|
||||
#
|
||||
# This test checks that if we push a hash to an array (in-place modification)
|
||||
# the cache does not get fooled, the hash is still wrapped as strong params,
|
||||
|
|
Loading…
Reference in a new issue