diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-09 12:50:18 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-09 12:50:18 +0000 |
commit | fc817eff447a268ce245a48369e7bd90d8f7f31f (patch) | |
tree | f0989d8b3858eb8b21da83b2eff8277c9dc3fdd1 /activerecord/CHANGELOG | |
parent | 586aa2f2b7b7bfe1476fd9093c9a283a6e693db1 (diff) | |
download | rails-fc817eff447a268ce245a48369e7bd90d8f7f31f.tar.gz rails-fc817eff447a268ce245a48369e7bd90d8f7f31f.tar.bz2 rails-fc817eff447a268ce245a48369e7bd90d8f7f31f.zip |
Added validation macros to make the stackable just like the lifecycle callbacks
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@94 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/CHANGELOG')
-rw-r--r-- | activerecord/CHANGELOG | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index eaaa2027b4..16ec1a1e14 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,18 @@ *CVS* +* Added validation macros to make the stackable just like the lifecycle callbacks. Examples: + + class Person < ActiveRecord::Base + validate { |record| record.errors.add("name", "too short") unless name.size > 10 } + validate { |record| record.errors.add("name", "too long") unless name.size < 20 } + validate_on_create :validate_password + + private + def validate_password + errors.add("password", "too short") unless password.size > 6 + end + end + * Added ActiveRecord::Mixins::Touch that will record creation and update times of objects [xal]. Example: class Bill < ActiveRecord::Base |