Entries from 2020-12-16 to 1 day
Active Recordの話です。 create_or_find_byの実装はcreateしてみてユニーク制約に引っかかったらfind_byしてみるなので、ふつうに考えるとfind_byは成功しそうに見えます。 def create_or_find_by(attributes, &block) transaction(requires_new: true) { c…
Active Recordの話です。 create_or_find_byの実装はcreateしてみてユニーク制約に引っかかったらfind_byしてみるなので、ふつうに考えるとfind_byは成功しそうに見えます。 def create_or_find_by(attributes, &block) transaction(requires_new: true) { c…