mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove deprecated support delete
errors from ActiveModel::Errors#messages
This commit is contained in:
parent
b2db6f390c
commit
bab78b5d54
4 changed files with 6 additions and 15 deletions
|
@ -1,3 +1,7 @@
|
|||
* Remove deprecated support `delete` errors from `ActiveModel::Errors#messages`.
|
||||
|
||||
*Rafael Mendonça França*
|
||||
|
||||
* Remove deprecated support `clear` errors from `ActiveModel::Errors#messages`.
|
||||
|
||||
*Rafael Mendonça França*
|
||||
|
|
|
@ -511,12 +511,6 @@ module ActiveModel
|
|||
__setobj__ prepare_content
|
||||
end
|
||||
|
||||
def delete(attribute)
|
||||
ActiveSupport::Deprecation.warn("Calling `delete` to an ActiveModel::Errors messages hash is deprecated. Please call `ActiveModel::Errors#delete` instead.")
|
||||
|
||||
@errors.delete(attribute)
|
||||
end
|
||||
|
||||
private
|
||||
def prepare_content
|
||||
content = @errors.to_hash
|
||||
|
|
|
@ -605,15 +605,6 @@ class ErrorsTest < ActiveModel::TestCase
|
|||
)
|
||||
end
|
||||
|
||||
test "messages delete (deprecated)" do
|
||||
person = Person.new
|
||||
person.validate!
|
||||
|
||||
assert_equal 1, person.errors.count
|
||||
assert_deprecated { person.errors.messages.delete(:name) }
|
||||
assert_empty person.errors
|
||||
end
|
||||
|
||||
test "group_by_attribute" do
|
||||
person = Person.new
|
||||
error = person.errors.add(:name, :invalid, message: "is bad")
|
||||
|
|
|
@ -138,6 +138,8 @@ Please refer to the [Changelog][active-model] for detailed changes.
|
|||
|
||||
* Remove deprecated support `clear` errors from `ActiveModel::Errors#messages`.
|
||||
|
||||
* Remove deprecated support `delete` errors from `ActiveModel::Errors#messages`.
|
||||
|
||||
### Deprecations
|
||||
|
||||
### Notable changes
|
||||
|
|
Loading…
Reference in a new issue