aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/CHANGELOG.md
diff options
context:
space:
mode:
authorwangjohn <wangjohn@mit.edu>2013-02-21 13:40:48 -0500
committerwangjohn <wangjohn@mit.edu>2013-03-19 12:23:20 -0400
commit3ee30ca44a6f965c2e9a60bcf84b45d9be726509 (patch)
tree2e4aee7523f6579db95300a7ccb19cada3d73c99 /activemodel/CHANGELOG.md
parent7d659ae9cd52cc0f752c09341989eb453dc0c536 (diff)
downloadrails-3ee30ca44a6f965c2e9a60bcf84b45d9be726509.tar.gz
rails-3ee30ca44a6f965c2e9a60bcf84b45d9be726509.tar.bz2
rails-3ee30ca44a6f965c2e9a60bcf84b45d9be726509.zip
The repair_validations helper was not working correctly before because
it only cleared the validations that created :validate callbacks. This didn't include the validates created by validates_with, so I've added a method to clear all validations.
Diffstat (limited to 'activemodel/CHANGELOG.md')
-rw-r--r--activemodel/CHANGELOG.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/activemodel/CHANGELOG.md b/activemodel/CHANGELOG.md
index 6ba0c7cd6b..62d684fd0b 100644
--- a/activemodel/CHANGELOG.md
+++ b/activemodel/CHANGELOG.md
@@ -1,5 +1,26 @@
## Rails 4.0.0 (unreleased) ##
+* Added a method so that validations can be easily cleared on a model.
+ For example:
+
+ class Person
+ include ActiveModel::Validations
+
+ validates_uniqueness_of :first_name
+ validate :cannot_be_robot
+
+ def cannot_be_robot
+ errors.add(:base, 'A person cannot be a robot') if person_is_robot
+ end
+ end
+
+ Now, if someone runs `Person.clear_validators!`, then the following occurs:
+
+ Person.validators # => []
+ Person._validate_callbacks.empty? # => true
+
+ *John Wang*
+
* `has_secure_password` does not fail the confirmation validation
when assigning empty String to `password` and `password_confirmation`.