aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-15 01:36:05 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-15 01:36:05 +0000
commit0bb824b7152c0a745dbec8983014b77eedb09726 (patch)
tree88e67c778a3b997626a494d1563a64db41be3e1d /activerecord/CHANGELOG
parent95314be65be197b6c38c8c93e3f8d1e8b5b0b674 (diff)
downloadrails-0bb824b7152c0a745dbec8983014b77eedb09726.tar.gz
rails-0bb824b7152c0a745dbec8983014b77eedb09726.tar.bz2
rails-0bb824b7152c0a745dbec8983014b77eedb09726.zip
Changed validate_* to validates_*_of, so validate_acceptance becomes validates_acceptance_of, and added :on as a configuration option instead of using _on_create/update
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@157 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/CHANGELOG')
-rw-r--r--activerecord/CHANGELOG16
1 files changed, 6 insertions, 10 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 78243608cd..4590f2c1a2 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -28,12 +28,12 @@
* Added Base.validate_presence as an alternative to implementing validate and doing errors.add_on_empty yourself.
-* Added Base.validate_uniqueness that alidates whether the value of the specified attributes are unique across the system.
+* Added Base.validates_uniqueness_of that alidates whether the value of the specified attributes are unique across the system.
Useful for making sure that only one user can be named "davidhh".
Model:
class Person < ActiveRecord::Base
- validate_uniqueness :user_name
+ validates_uniqueness_of :user_name
end
View:
@@ -43,11 +43,11 @@
attribute (that maps to a column). When the record is updated, the same check is made but disregarding the record itself.
-* Added Base.validate_confirmation that encapsulates the pattern of wanting to validate a password or email address field with a confirmation. Example:
+* Added Base.validates_confirmation_of that encapsulates the pattern of wanting to validate a password or email address field with a confirmation. Example:
Model:
class Person < ActiveRecord::Base
- validate_confirmation :password
+ validates_confirmation_of :password
end
View:
@@ -56,23 +56,19 @@
The person has to already have a password attribute (a column in the people table), but the password_confirmation is virtual.
It exists only as an in-memory variable for validating the password. This check is performed both on create and update.
- See validate_confirmation_on_create and validate_confirmation_on_update if you want to restrict the validation to just one of the two
- situations.
-* Added Base.validate_confirmation that encapsulates the pattern of wanting to validate the acceptance of a terms of service check box (or similar agreement). Example:
+* Added Base.validates_acceptance_of that encapsulates the pattern of wanting to validate the acceptance of a terms of service check box (or similar agreement). Example:
Model:
class Person < ActiveRecord::Base
- validate_acceptance :terms_of_service
+ validates_acceptance_of :terms_of_service
end
View:
<%= check_box "person", "terms_of_service" %>
The terms_of_service attribute is entirely virtual. No database column is needed. This check is performed both on create and update.
- See validate_acceptance_on_create and validate_acceptance_on_update if you want to restrict the validation to just one of the two
- situations.
NOTE: The agreement is considered valid if it's set to the string "1". This makes it easy to relate it to an HTML checkbox.