Methods

Class/Module Index [+]

Quicksearch

ActiveSupport::CoreExtensions::Hash::Except

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))

Public Instance Methods

except(*keys) click to toggle source

Returns a new hash without the given keys.

# File lib/active_support/core_ext/hash/except.rb, line 12
def except(*keys)
  dup.except!(*keys)
end
except!(*keys) click to toggle source

Replaces the hash without the given keys.

# File lib/active_support/core_ext/hash/except.rb, line 17
def except!(*keys)
  keys.map! { |key| convert_key(key) } if respond_to?(:convert_key)
  keys.each { |key| delete(key) }
  self
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.