タグ

ブックマーク / thoughtbot.com (1)

  • The Perils of Uniqueness Validations

    Your Rails application probably makes use of uniqueness validations in several key places. This validation provides for a nice user experience when duplicate records are detected but as we will see in a moment, is not enough to ensure data integrity. What Can Go Wrong Let’s take a look at our sample User class. When you persist a user instance, Rails will validate your model by running a SELECT qu

    The Perils of Uniqueness Validations
    matsubobo
    matsubobo 2015/05/19
    ActiveRecord使っているエンジニアは、この問題をどうやって回避してコーディングしているのだろうか。1.気にしないでARで書く。2.悲観的ロックを使う。3.楽観的ロックを使う。
  • 1