한 레코드에 동시 접속 막자!! with_lock
상황
해결
def create_dual_match_for(user, rule_id, target_score)
match =
Match.create(
match_type: 'dual',
status: 'pending',
rule_id: rule_id,
target_score: target_score,
)
card = Scorecard.create(user_id: user.id, match_id: match.id, side: 'left')
user.update_status('playing')
match
endLast updated