提交 1d738cab 编写于 作者: M Marcel Molina

Make update_attribute use the same writer method that update_attributes uses.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2353 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 1465f9ce
*SVN*
* Make update_attribute use the same writer method that update_attributes uses.
#2237 [trevor@protocool.com]
* Make migrations honor table name prefixes and suffixes. #2298 [Jakob S, Marcel Molina]
* Correct and optimize PostgreSQL bytea escaping. #1745, #1837 [dave@cherryville.org, ken@miriamtech.com, bellis@deepthought.org]
......
......@@ -1057,7 +1057,7 @@ def clone
# Note: This method is overwritten by the Validation module that'll make sure that updates made with this method
# doesn't get subjected to validation checks. Hence, attributes can be updated even if the full object isn't valid.
def update_attribute(name, value)
self[name] = value
send(name.to_s + '=', value)
save
end
......
......@@ -661,7 +661,7 @@ def save!
# This is especially useful for boolean flags on existing records. The regular +update_attribute+ method
# in Base is replaced with this when the validations module is mixed in, which it is by default.
def update_attribute_with_validation_skipping(name, value)
self[name] = value
send(name.to_s + '=', value)
save(false)
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册