From ebe1775b78d14fb82fe7306e29e5085dd653f8c5 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 12 Sep 2009 14:49:03 +0200 Subject: documents in Hash#except that convert_key is honored --- activesupport/lib/active_support/core_ext/hash/except.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activesupport') 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 -- cgit v1.2.3