aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/strong_parameters.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2013-01-22 11:17:27 +0100
committerXavier Noria <fxn@hashref.com>2013-01-22 11:18:41 +0100
commit2d9c4017dd294e336e0245251f67bf490370305d (patch)
tree008c7698b7368688fa34c5a31d827b2509bb92ea /actionpack/lib/action_controller/metal/strong_parameters.rb
parent00928bb4c984f2f3fe30c99ae34134a166e6cfb1 (diff)
downloadrails-2d9c4017dd294e336e0245251f67bf490370305d.tar.gz
rails-2d9c4017dd294e336e0245251f67bf490370305d.tar.bz2
rails-2d9c4017dd294e336e0245251f67bf490370305d.zip
avoid creating an object in every call
This was a suggestion of @carlosantoniodasilva, thanks!
Diffstat (limited to 'actionpack/lib/action_controller/metal/strong_parameters.rb')
-rw-r--r--actionpack/lib/action_controller/metal/strong_parameters.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb
index 0d84fbb62b..a78a24622d 100644
--- a/actionpack/lib/action_controller/metal/strong_parameters.rb
+++ b/actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -401,6 +401,7 @@ module ActionController
end
end
+ EMPTY_ARRAY = []
def hash_filter(params, filter)
filter = filter.with_indifferent_access
@@ -408,7 +409,7 @@ module ActionController
slice(*filter.keys).each do |key, value|
return unless value
- if filter[key] == []
+ if filter[key] == EMPTY_ARRAY
# Declaration { comment_ids: [] }.
array_of_permitted_scalars_filter(params, key)
else