Closed victorhazbun closed 4 years ago
The way n_plus_one_control works is the following:
populate
block)So, if we take a look at the example in Readme:
context "N+1", :n_plus_one do
# Here is how we use scale factors: we generate the different number of records
# (assuming that the code above load them all and potentially load the children associations
# thus producing N+1)
populate { |n| create_list(:post, n) }
specify do
expect { get :index }.to perform_constant_number_of_queries
end
end
Can you please explain what is the scale factor for?
Thanks.