Squash N 1 queries early with n_plus_one_control test matchers for Ruby and Rails
29-Oct-2020 1779
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 #Squash #queries #early #n_plus_one_control #matchers #Rails #test https://rubyonrails.ba/link/squash-n-1-queries-early-with-n_plus_one_control-test-matchers-for-ruby-and-rails