Add warning in documentation for increment!, decrement! and toggle! methods. Closes #11098 [DefV]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9011 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Pratik Naik 2008-03-11 12:05:06 +00:00
parent 3a17ea9031
commit 8cc28daad6
1 changed files with 3 additions and 0 deletions

View File

@ -2139,6 +2139,7 @@ module ActiveRecord #:nodoc:
end
# Increments the +attribute+ and saves the record.
# Note: Updates made with this method aren't subjected to validation checks
def increment!(attribute, by = 1)
increment(attribute, by).update_attribute(attribute, self[attribute])
end
@ -2151,6 +2152,7 @@ module ActiveRecord #:nodoc:
end
# Decrements the +attribute+ and saves the record.
# Note: Updates made with this method aren't subjected to validation checks
def decrement!(attribute, by = 1)
decrement(attribute, by).update_attribute(attribute, self[attribute])
end
@ -2162,6 +2164,7 @@ module ActiveRecord #:nodoc:
end
# Toggles the +attribute+ and saves the record.
# Note: Updates made with this method aren't subjected to validation checks
def toggle!(attribute)
toggle(attribute).update_attribute(attribute, self[attribute])
end