Skip to content
Browse files

Deprecate update_attribute_with_validation_skipping. [#1357 state:res…

…olved]
  • Loading branch information...
1 parent 814d1ce commit 850290cc22b22db59ac564c49998acf34d374e6c @lifo lifo committed Nov 14, 2008
Showing with 11 additions and 0 deletions.
  1. +5 −0 activerecord/lib/active_record/validations.rb
  2. +6 −0 activerecord/test/cases/base_test.rb
View
5 activerecord/lib/active_record/validations.rb
@@ -923,6 +923,11 @@ def save_with_validation!
end
end
+ def update_attribute_with_validation_skipping(name, value)
+ ActiveSupport::Deprecation.warn "Base#update_attribute_with_validation_skipping has been deprecated, use Base#update_attribute instead"
+ update_attribute(name, value)
+ end
+
# Runs +validate+ and +validate_on_create+ or +validate_on_update+ and returns true if no errors were added otherwise false.
def valid?
errors.clear
View
6 activerecord/test/cases/base_test.rb
@@ -832,6 +832,12 @@ def test_update_attribute
assert !Topic.find(1).approved?
end
+ def test_deprecated_update_attribute
+ assert !Topic.find(1).approved?
+ assert_deprecated { Topic.find(1).update_attribute_with_validation_skipping("approved", true) }
+ assert Topic.find(1).approved?
+ end
+
def test_update_attributes
topic = Topic.find(1)
assert !topic.approved?

0 comments on commit 850290c

Please sign in to comment.
Something went wrong with that request. Please try again.