mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
adding comments to update_attribute method
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user