Return a hash that includes everything but the given keys. This is useful for limiting a set of parameters to everything but a few known toggles:
@person.update_attributes(params[:person].except(:admin))
Methods
Public Instance methods
Returns a new hash without the given keys.
[ show source ]
# File activesupport/lib/active_support/core_ext/hash/except.rb, line 12 12: def except(*keys) 13: dup.except!(*keys) 14: end
Replaces the hash without the given keys.
[ show source ]
# File activesupport/lib/active_support/core_ext/hash/except.rb, line 17 17: def except!(*keys) 18: keys.map! { |key| convert_key(key) } if respond_to?(:convert_key) 19: keys.each { |key| delete(key) } 20: self 21: end