Hard work by INTERNET

ベンチャーで働くひとりぼっちWEB開発者が頑張るブログ

updated_attributeメソッドで 属性が変更されなかったならtrueを返す

github.com

issue本文

If the attribute is not changed, then update_attribute does not run SQL query, this effectively means that no change was made to the attribute.

属性が変更されなかったらupdate_attributeメソッドはSQLクエリを実行せず、実際には項目に変更はなかったことを意味する。

This change was made in 0fcd4cf to avoid a SQL call.

この変更は SQLコールを防ぐ ofcd4cf で作られた。

But the change resulted into nil being returned when there was no change in the attribute value.

しかし、この変更の結果は、属性の値に変更がないときにnilを返すことになる

This commit corrects the behavior to return true if there is no change in attribute value. This is same as previous behavior of Rails 4.2 plus benefit of no additional SQL call. Fixes #26593.

属性の値に変更がない場合、trueを返す動作のコミットは正しい。

This is same as previous behavior of Rails 4.2 plus benefit of no additional SQL call.

この修正は、rails4.2以前と動作が同じである。
(of が多くて単語の切れ目とplus benefit がどこに掛かっているのかわからず)

@tenderlove We should backport as well, as this behavior was originally changed on 5.0.

バックポーツするべきだ。この振る舞いは5.0で変更された。

There was a conflict with persistence_test.rb so this commit could not be cherry-picked directly to 5-0-stable. I fixed the conflict and opened #26603 for back porting.

persistence_test.rb でコンフリクトがあって、5-0-stableに直接チェリーピックができなかった。 私は、コンフリクトの解消と バックポーツのために #26603 をオープンした。