1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix ActiveResource::Errors deprecation messages

This commit is contained in:
Pratik Naik 2009-03-20 18:51:01 +00:00
parent bc1dd0b82e
commit 09afbfd47f
2 changed files with 4 additions and 4 deletions

View file

@ -4,7 +4,7 @@ module ActiveResource
# Active Resource validation is reported to and from this object, which is used by Base#save
# to determine whether the object in a valid state to be saved. See usage example in Validations.
class Errors < ::ActiveModel::Errors
class Errors < ActiveModel::Errors
# Grabs errors from the XML response.
def from_xml(xml)
clear
@ -38,7 +38,7 @@ module ActiveResource
# person.errors.empty? # => false
# person.errors.count # => 1
# person.errors.full_messages # => ["Last name can't be empty"]
# person.errors.on(:last_name) # => "can't be empty"
# person.errors[:last_name] # => ["can't be empty"]
# person.last_name = "Halpert"
# person.save # => true (and person is now saved to the remote service)
#

View file

@ -21,9 +21,9 @@ class BaseErrorsTest < Test::Unit::TestCase
def test_should_parse_errors_to_individual_attributes
assert @person.errors.invalid?(:name)
assert_equal "can't be blank", @person.errors.on(:age)
assert_equal ["can't be blank"], @person.errors[:age]
assert_equal ["can't be blank", "must start with a letter"], @person.errors[:name]
assert_equal "Person quota full for today.", @person.errors.on_base
assert_equal ["Person quota full for today."], @person.errors[:base]
end
def test_should_iterate_over_errors