method

slice!

Importance_1
v6.1.7.7 - Show latest stable - 0 notes - Class: ActiveModel::Errors
slice!(*keys) public

Removes all errors except the given keys. Returns a hash containing the removed errors.

person.errors.keys                  # => [:name, :age, :gender, :city]
person.errors.slice!(:age, :gender) # => { :name=>["cannot be nil"], :city=>["cannot be nil"] }
person.errors.keys                  # => [:age, :gender]
Show source
Register or log in to add new notes.