aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2017-01-08 20:56:38 +0100
committerGitHub <noreply@github.com>2017-01-08 20:56:38 +0100
commit7f19f30819dd5a5a788ad9d8b12b5dda76559a12 (patch)
tree4cc10cda2fca824cd3a41ce5783452c3fff021d0 /activerecord/lib
parentee47aab757b21740372441ff7d77b63201cb432d (diff)
parent115e31440cd48a5c6f00675f69b93eb7d4410181 (diff)
downloadrails-7f19f30819dd5a5a788ad9d8b12b5dda76559a12.tar.gz
rails-7f19f30819dd5a5a788ad9d8b12b5dda76559a12.tar.bz2
rails-7f19f30819dd5a5a788ad9d8b12b5dda76559a12.zip
Merge pull request #25427 from eugeneius/update_increment_documentation
Update increment! documentation [ci skip]
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/persistence.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index 63d8a201f0..19fe9632ca 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -338,10 +338,10 @@ module ActiveRecord
self
end
- # Wrapper around #increment that saves the record. This method differs from
- # its non-bang version in that it passes through the attribute setter.
- # Saving is not subjected to validation checks. Returns +true+ if the
- # record could be saved.
+ # Wrapper around #increment that writes the update to the database.
+ # Only +attribute+ is updated; the record itself is not saved.
+ # This means that any other modified attributes will still be dirty.
+ # Validations and callbacks are skipped. Returns +self+.
def increment!(attribute, by = 1)
increment(attribute, by)
change = public_send(attribute) - (attribute_in_database(attribute.to_s) || 0)
@@ -357,10 +357,10 @@ module ActiveRecord
increment(attribute, -by)
end
- # Wrapper around #decrement that saves the record. This method differs from
- # its non-bang version in the sense that it passes through the attribute setter.
- # Saving is not subjected to validation checks. Returns +true+ if the
- # record could be saved.
+ # Wrapper around #decrement that writes the update to the database.
+ # Only +attribute+ is updated; the record itself is not saved.
+ # This means that any other modified attributes will still be dirty.
+ # Validations and callbacks are skipped. Returns +self+.
def decrement!(attribute, by = 1)
increment!(attribute, -by)
end