From 6860db61f516b813af624d38b47fef0bf983539c Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 16 Dec 2004 16:23:59 +0000 Subject: Renamed Mixins to Acts to resemble the change from include ActiveRecord::Mixins::List to acts_as_list and renamed @@default_error_messagess to @@default_error_messages git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@190 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/README | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'activerecord/README') diff --git a/activerecord/README b/activerecord/README index 258b98f296..e5a5e5a6d8 100755 --- a/activerecord/README +++ b/activerecord/README @@ -57,18 +57,26 @@ A short rundown of the major features: * Validation rules that can differ for new or existing objects. - class Post < ActiveRecord::Base - def validate # validates on both creates and updates - errors.add_on_empty "title" - end - - def validate_on_update - errors.add_on_empty "password" - end - end + class Account < ActiveRecord::Base + validates_presence_of :subdomain, :name, :email_address, :password + validates_uniqueness_of :subdomain + validates_acceptance_of :terms_of_service, :on => :create + validates_confirmation_of :password, :email_address, :on => :create + end Learn more in link:classes/ActiveRecord/Validations.html + +* Acts that can make records work as lists or trees: + + class Item < ActiveRecord::Base + belongs_to :list + acts_as_list :scope => :list + end + + item.move_higher + item.move_to_bottom + * Callbacks as methods or queues on the entire lifecycle (instantiation, saving, destroying, validating, etc). -- cgit v1.2.3