diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2012-09-01 02:30:07 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2012-09-16 23:58:21 -0500 |
commit | 91bcebbdef0e31d38622785a064d023272f712db (patch) | |
tree | b629daa30db373d75dd2c3c760f572d0d706fb44 /actionpack/lib/action_controller | |
parent | 1aaf4490b29afc99cf19b18c4edbb1f28e6c37f5 (diff) | |
download | rails-91bcebbdef0e31d38622785a064d023272f712db.tar.gz rails-91bcebbdef0e31d38622785a064d023272f712db.tar.bz2 rails-91bcebbdef0e31d38622785a064d023272f712db.zip |
Support fields_for attributes, which may have numeric symbols as hash keys
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal/strong_parameters.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index 8a2f63dfcd..11b7919b4b 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -94,6 +94,10 @@ module ActionController def each_element(object) if object.is_a?(Array) object.map { |el| yield el }.compact + elsif object.is_a?(Hash) && object.keys.all? { |k| k =~ /\A-?\d+\z/ } + hash = object.class.new + object.each { |k,v| hash[k] = yield v } + hash else yield object end |