Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v6.1.7.7) is shown here.
slice!(*keys)
public
Removes all errors except the given keys. Returns a hash containing
the removed errors.
person.errors.keys
person.errors.slice!(:age, :gender)
person.errors.keys
# File activemodel/lib/active_model/errors.rb, line 146
def slice!(*keys)
deprecation_removal_warning(:slice!)
keys = keys.map(&:to_sym)
results = messages.dup.slice!(*keys)
@errors.keep_if do |error|
keys.include?(error.attribute)
end
results
end