aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/persistence.rb
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2010-07-27 13:55:00 -0400
committerNeeraj Singh <neerajdotname@gmail.com>2010-07-27 13:55:00 -0400
commitc9fe3c3bd0ee5010a36a157fe850ef6e8ffb147d (patch)
treefeefb533fb3a96e802f01710bd3a2212cad64136 /activerecord/lib/active_record/persistence.rb
parentf3409dc0a0b7f0ce009825f8df806b391ff770ec (diff)
downloadrails-c9fe3c3bd0ee5010a36a157fe850ef6e8ffb147d.tar.gz
rails-c9fe3c3bd0ee5010a36a157fe850ef6e8ffb147d.tar.bz2
rails-c9fe3c3bd0ee5010a36a157fe850ef6e8ffb147d.zip
adding comments to update_attribute method
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r--activerecord/lib/active_record/persistence.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index b587abd5d0..869cbf5b2e 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -110,6 +110,10 @@ module ActiveRecord
# * 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.
+ # * does not work on new record. <tt>record.new_record?</tt> should return false for this method to work.
+ # * updates only the attribute that is input to the method. If there are other changed attributes then
+ # those attributes are left alone. In that case even after this method has done its work <tt>record.changed?</tt>
+ # will return true.
#
def update_attribute(name, value)
raise ActiveRecordError, "#{name.to_s} is marked as readonly" if self.class.readonly_attributes.include? name.to_s