Introduction If you’ve created web apps with relational databases and ORMs like Active Record (part of Ruby on Rails), you’ve probably experienced database performance problems after a certain size of data and query volume.
PostgreSQL table partitioning is a great way to improve database bloat but is hard to manage. The pg_partition_manager gem can help you maintain partitions.
Rails' Active Storage makes file uploads easy, but validation errors can cause attachments to be lost when forms re-render. This guide explains why and walks through a step-by-step solution using direct uploads, signed IDs, and Stimulus for an improved user experience.
Writing code with LLMs is fundamentally different from other ways of programming. LLMs are often non-deterministic and always unpredictable. They have a…
Instead of leaning into heavy social sharing widgets, you can create a truly user-friendly social sharing component that works for everyone, using built-in APIs and progressive enhancement.
Need to catch N+1 queries without adding any extra dependencies to your project?
Strict Loading makes it effortless, but your configurations need to be set up correctly to avoid unexpected behaviors.
Implementing an Inventory Module in Ruby on Rails: Handling Concurrency with Database Locks and SKIP LOCKED When implementing an inventory module in a Ruby on Rails application, ensuring consistency in stock levels is crucial. If multiple users try to purchase the same item simultaneously, concurrency issues can lead to overselling. In this post, we’ll explore two approaches to handling inventory management: Using a simple counter with database locks to prevent race conditions. Improving performance using SKIP LOCKED for efficient inventory allocation.