开发者

Will update_attributes release lock in Rails?

开发者 https://www.devze.com 2023-03-10 19:56 出处:网络
Code @abc = Abc.find(1,:lock => true) @abc.update_attributes!(:title => \"ABC title\") update_attributes will relea开发者_JAVA百科se a lock or not ? OR only @abc.save! will release a lock ?#

Code

@abc = Abc.find(1,:lock => true)
@abc.update_attributes!(:title => "ABC title")

update_attributes will relea开发者_JAVA百科se a lock or not ? OR only @abc.save! will release a lock ?


# File activeresource/lib/active_resource/base.rb, line 1267
def update_attributes(attributes)
  load(attributes) && save
end

So if save releases a lock, then update_attributes will do the same.

0

精彩评论

暂无评论...
验证码 换一张
取 消