diff options
author | Xavier Noria <fxn@hashref.com> | 2009-09-12 14:49:03 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2009-09-12 14:49:03 +0200 |
commit | ebe1775b78d14fb82fe7306e29e5085dd653f8c5 (patch) | |
tree | e724faa357d8e149456e01f26822d8cab56fea3a | |
parent | f56b814671ba686f4bfc5b1a7ca5a32d11a33846 (diff) | |
download | rails-ebe1775b78d14fb82fe7306e29e5085dd653f8c5.tar.gz rails-ebe1775b78d14fb82fe7306e29e5085dd653f8c5.tar.bz2 rails-ebe1775b78d14fb82fe7306e29e5085dd653f8c5.zip |
documents in Hash#except that convert_key is honored
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/except.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/except.rb b/activesupport/lib/active_support/core_ext/hash/except.rb index 6d04cb5621..207801d3a7 100644 --- a/activesupport/lib/active_support/core_ext/hash/except.rb +++ b/activesupport/lib/active_support/core_ext/hash/except.rb @@ -3,6 +3,14 @@ class Hash # limiting a set of parameters to everything but a few known toggles: # # @person.update_attributes(params[:person].except(:admin)) + # + # If the receiver responds to +convert_key+, the method is called on each of the + # arguments. This allows +except+ to play nice with hashes with indifferent access + # for instance: + # + # {:a => 1}.with_indifferent_access.except(:a) # => {} + # {:a => 1}.with_indifferent_access.except("a") # => {} + # def except(*keys) dup.except!(*keys) end |