Permalink
Browse files

Fix ActiveResource::Errors deprecation messages

  • Loading branch information...
lifo committed Mar 20, 2009
1 parent bc1dd0b commit 09afbfd47f8180bb6d5f907abdeab6badeda879e
Showing with 4 additions and 4 deletions.
  1. +2 −2 activeresource/lib/active_resource/validations.rb
  2. +2 −2 activeresource/test/base_errors_test.rb
@@ -4,7 +4,7 @@ class ResourceInvalid < ClientError #:nodoc:
# 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 @@ def from_xml(xml)
# 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)
#
@@ -21,9 +21,9 @@ def test_should_parse_xml_errors
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

0 comments on commit 09afbfd

Please sign in to comment.