When several people touch a database simultaneously, software conflicts can occur when more than one user tries to update the same record. The most sought-after way to avoid problems from this point of view is to lock the record the first user needs to change. Such conflicts are dealt with in Ruby on Rails using two locking strategies: Optimistic Locking and Pessimistic Locking. This article discusses these strategies, their differences, and how they can be implemented in Ruby on Rails.

Read next
A Simpler Way to Set Content Types in Rails
Rails now lets you set content types with less code. This new feature makes your work easier.

The behavior of stringify_keys in the upcoming version of Rails has changed.
A new Rails update fixes how the stringify_keys handles different types of hash keys. This change makes the code more reliable and consistent.

Simplifying Payments with Pay gem: A Guide to Using Stripe in Rails
Use the Pay gem (v11.6) with Stripe in Rails 6+ to ship subscriptions, one-time charges, and webhooks behind a single interface - no per-gateway plumbing.
Tell us whatyou need built
JetThoughts has been building software since 2008. Book a call, or write to sales@jetthoughts.com. You'll leave the call with a written one-page scope within 2 working days.

A 30-minute call; pick a time.