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.
I’ve been recently working on a Slack bot and Slack delivers all events (webhooks)
to the same URL that you can configure. That means you need to distinguish
between different events types based on the payload (request body).
In the past, I’ve seen that
Rails apps usually reimplement their own “slack routing” within a single controller
action. I wanted to share a different solution that I came up with.
Let’s do routing in rails routing.
For the past few months I've been introducing sprints into a chaotic startup that's been growing so fast everyone's got whiplash. Since August, 5 engineers turned into 12. I think it's starting to work.
In this guide I will explain how I configured and deployed a Rails 8.0.2 application using Kamal 2 with a Postgres database running as a kamal accessory on a single Virtual Private Server (VPS).
The presenter pattern is a handy design approach that sits between your views and models, helping you keep your code organized by handling view-specific logic in a clean and maintainable way.
Let’s explore how to use it you your rails app.
Every Rails app has a breaking point. Follow along and learn how to test your application's performance under load with the Apache JMeter's Rails load testing.