From f84d081faf6812a947aebf3e67978f3d3bbb31f0 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 7 Jun 2014 13:30:03 +0200 Subject: adds some details to the rationale of converted_arrays [ci skip] --- actionpack/lib/action_controller/metal/strong_parameters.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'actionpack/lib/action_controller/metal') diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index 55954d0f37..c3c3e4c4f1 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -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 -- cgit v1.2.3