aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-03-21 18:29:15 +0000
committerPratik Naik <pratiknaik@gmail.com>2009-03-21 18:34:05 +0000
commit320933205e16164ff55245aef1e95fb06e609d06 (patch)
tree682db473d23e12a6a9b5c729e7bb67039f0e96be /activeresource
parent2bc4189faf1dc9ebc59054be0b54e15d098ab1f2 (diff)
downloadrails-320933205e16164ff55245aef1e95fb06e609d06.tar.gz
rails-320933205e16164ff55245aef1e95fb06e609d06.tar.bz2
rails-320933205e16164ff55245aef1e95fb06e609d06.zip
Deprecate Errors#on_base/add_to_base/invalid?/each_full
Diffstat (limited to 'activeresource')
-rw-r--r--activeresource/lib/active_resource/validations.rb2
-rw-r--r--activeresource/test/abstract_unit.rb3
-rw-r--r--activeresource/test/base_errors_test.rb4
3 files changed, 6 insertions, 3 deletions
diff --git a/activeresource/lib/active_resource/validations.rb b/activeresource/lib/active_resource/validations.rb
index 7fe3162c02..9d3d45b010 100644
--- a/activeresource/lib/active_resource/validations.rb
+++ b/activeresource/lib/active_resource/validations.rb
@@ -17,7 +17,7 @@ module ActiveResource
end
end
- add_to_base message if attr_message.nil?
+ self[:base] << message if attr_message.nil?
end
end
end
diff --git a/activeresource/test/abstract_unit.rb b/activeresource/test/abstract_unit.rb
index 0f11ea482a..ce9371d050 100644
--- a/activeresource/test/abstract_unit.rb
+++ b/activeresource/test/abstract_unit.rb
@@ -14,6 +14,9 @@ require 'setter_trap'
ActiveResource::Base.logger = Logger.new("#{File.dirname(__FILE__)}/debug.log")
+# Show backtraces for deprecated behavior for quicker cleanup.
+ActiveSupport::Deprecation.debug = true
+
def uses_gem(gem_name, test_name, version = '> 0')
gem gem_name.to_s, version
require gem_name.to_s
diff --git a/activeresource/test/base_errors_test.rb b/activeresource/test/base_errors_test.rb
index 8c177c8006..28813821df 100644
--- a/activeresource/test/base_errors_test.rb
+++ b/activeresource/test/base_errors_test.rb
@@ -20,7 +20,7 @@ class BaseErrorsTest < Test::Unit::TestCase
end
def test_should_parse_errors_to_individual_attributes
- assert @person.errors.invalid?(:name)
+ assert @person.errors[:name].any?
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[:base]
@@ -34,7 +34,7 @@ class BaseErrorsTest < Test::Unit::TestCase
def test_should_iterate_over_full_errors
errors = []
- @person.errors.each_full { |message| errors << message }
+ @person.errors.to_a.each { |message| errors << message }
assert errors.include?("Name can't be blank")
end