method

slice!

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ActiveModel::Errors

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.

These similar methods exist in v7.1.3.2:

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.