diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-16 16:23:59 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-16 16:23:59 +0000 |
commit | 6860db61f516b813af624d38b47fef0bf983539c (patch) | |
tree | af6fa07944f5af223b96351a629fc38323870137 /activerecord/README | |
parent | 12f10f6baf7e38c74db24585d901063cd094867b (diff) | |
download | rails-6860db61f516b813af624d38b47fef0bf983539c.tar.gz rails-6860db61f516b813af624d38b47fef0bf983539c.tar.bz2 rails-6860db61f516b813af624d38b47fef0bf983539c.zip |
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
Diffstat (limited to 'activerecord/README')
-rwxr-xr-x | activerecord/README | 26 |
1 files changed, 17 insertions, 9 deletions
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). |