aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2007-12-05 15:06:45 +0000
committerMarcel Molina <marcel@vernix.org>2007-12-05 15:06:45 +0000
commit6bd7d30e75ee28ac0038bde4ffff8c37533ecf0a (patch)
treeffed165882315e37024ab01843ce64297d9eb6a1 /activerecord/lib/active_record/base.rb
parentb4337c236e20cec0ec2c5e7b57e76e41bc69b84d (diff)
downloadrails-6bd7d30e75ee28ac0038bde4ffff8c37533ecf0a.tar.gz
rails-6bd7d30e75ee28ac0038bde4ffff8c37533ecf0a.tar.bz2
rails-6bd7d30e75ee28ac0038bde4ffff8c37533ecf0a.zip
Document options for update_counters. Closes #8091 [fearoffish]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8289 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-xactiverecord/lib/active_record/base.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 616b164b13..dad0573d88 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -574,7 +574,19 @@ module ActiveRecord #:nodoc:
# with the given ID, altering the given hash of counters by the amount
# given by the corresponding value:
#
+ # ==== Options
+ #
+ # +id+ The id of the object you wish to update a counter on
+ # +counters+ An Array of Hashes containing the names of the fields
+ # to update as keys and the amount to update the field by as
+ # values
+ #
+ # ==== Examples
+ #
+ # # For the Post with id of 5, decrement the comment_count by 1, and
+ # # increment the action_count by 1
# Post.update_counters 5, :comment_count => -1, :action_count => 1
+ # # Executes the following SQL:
# # UPDATE posts
# # SET comment_count = comment_count - 1,
# # action_count = action_count + 1