Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated AR to work with the AMo model validation changes

  • Loading branch information...
commit e17ff6d617abe3fa36c053eaed52e134074035a1 1 parent 66913a7
Josh Kalderimis joshk authored Carl Lerche committed
6 activerecord/lib/active_record/validations.rb
View
@@ -74,7 +74,7 @@ def save_with_validation!
def valid?
errors.clear
- @_on_validate = new_record? ? :create : :update
+ self.validation_context = new_record? ? :create : :update
_run_validate_callbacks
deprecated_callback_method(:validate)
@@ -87,6 +87,10 @@ def valid?
errors.empty?
end
+
+ def invalid?
+ !valid?
+ end
end
end
end
2  activerecord/test/cases/validations_test.rb
View
@@ -44,7 +44,7 @@ class ValidationsTest < ActiveRecord::TestCase
def test_error_on_create
r = WrongReply.new
r.title = "Wrong Create"
- assert !r.valid?
+ assert !r.save
assert r.errors[:title].any?, "A reply with a bad title should mark that attribute as invalid"
assert_equal ["is Wrong Create"], r.errors[:title], "A reply with a bad content should contain an error"
end
Please sign in to comment.
Something went wrong with that request. Please try again.