Squash N 1 queries early with n_plus_one_control test matchers for Ruby and Rails

Discover the performance testing alternative to detecting N 1 query problem in your Rails and pure Ruby applications.Every backend Ruby developer who works with databases through object-relational mappers like Active Record or rom knows the drill: you need to be careful with your database queries so as not to generate too many of them. Even though the N 1 problem is well-known, it is still impossible to outsmart ORMs every single time: we need an automated way to signal the problem.For the past three years, I’ve been using my own little tool that helps me to detect N 1 at the earliest stage possible: while running RSpec or Minitest on my code. My n_plus_one_control gem has been slowly maturing and has recently hit the 0.5.0 version, so I feel it’s time to show you what it’s all about and how my approach is different from more popular tools out there.
Squash N 1 queries early with n_plus_one_control test matchers for Ruby and Rails #ruby #rubydeveloper #rubyonrails #test https://rubyonrails.ba/single/squash-n-1-queries-early-with-n_plus_one_control-test-matchers-for-ruby-and-rails

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles