Locks
Model lock
Clear::SQL.transaction do
# SELECT * FROM users WHERE organization = 'Crystal Lang' FOR UPDATE
User.where(organization: "Crystal Lang").with_lock.each do |user|
# Do something with your users
end
endLast updated