提交 5c137939 编写于 作者: N Neeraj Singh 提交者: Xavier Noria

expanded comment for update_attribute method

上级 efdfcf13
......@@ -102,8 +102,15 @@ def becomes(klass)
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册