Category: Rails

Avoiding N+1 Queries with Rails Virtual Attributes

Virtual attributes in Rails can be useful for eliminating N+1 queries, which often lead to slower requests and increase the need for premature scaling. What Are N+1 Queries? N+1 queries can occur whenever we have records with has_many associations that we lazy load in our application. When loading a set of records and then loading each […]

Read More