aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2010-07-20 06:56:20 -0400
committerXavier Noria <fxn@hashref.com>2010-07-22 01:28:30 +0200
commit5c137939a7b9d32a46eb07c90d6b535c7c67db64 (patch)
tree88cb6b454b8f136d43ed95a46221aacdcf8deea6 /activerecord
parentefdfcf13257769cf2d6f9ad85c8538e64007d97b (diff)
downloadrails-5c137939a7b9d32a46eb07c90d6b535c7c67db64.tar.gz
rails-5c137939a7b9d32a46eb07c90d6b535c7c67db64.tar.bz2
rails-5c137939a7b9d32a46eb07c90d6b535c7c67db64.zip
expanded comment for update_attribute method
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/persistence.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index e2d92c860c..b587abd5d0 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -102,8 +102,15 @@ module ActiveRecord
became
end
- # Updates a single attribute and saves the record without going through the normal validation procedure
- # or callbacks. This is especially useful for boolean flags on existing records.
+ # Updates a single attribute and saves the record.
+ # This is especially useful for boolean flags on existing records. Also note that
+ #
+ # * validation is skipped
+ # * No callbacks are invoked
+ # * updated_at/updated_on column is updated if that column is available
+ # * does not work on associations
+ # * does not work on attr_accessor attributes. The attribute that is being updated must be column name.
+ #
def update_attribute(name, value)
raise ActiveRecordError, "#{name.to_s} is marked as readonly" if self.class.readonly_attributes.include? name.to_s