From fc817eff447a268ce245a48369e7bd90d8f7f31f Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 9 Dec 2004 12:50:18 +0000 Subject: 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 --- activerecord/CHANGELOG | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'activerecord/CHANGELOG') 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 -- cgit v1.2.3