Given two models, what is the issue with the query used to fetch them? class LineItem < ApplicationRecord end class Order < ApplicationRecord has_many :line_items end Order.limit(3).each { |order| puts order.line_items }
1.This query will result in extensive caching, and you will have to then deal with caching issues.
2.This query will result in the N+1 query issue. Three orders will result in four queries.
3.This query will result in the 1 query issue. Three orders will result in one query.
4.There are no issues with this query, and you are correctly limiting the number of Order models that will be loaded.
Posted Date:-2022-09-17 05:22:13