Permalink
Browse files

documents in Hash#except that convert_key is honored

  • Loading branch information...
fxn committed Sep 12, 2009
1 parent f56b814 commit ebe1775b78d14fb82fe7306e29e5085dd653f8c5
Showing with 8 additions and 0 deletions.
  1. +8 −0 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

0 comments on commit ebe1775

Please sign in to comment.