A Rails e-commerce app experiences N+1 queries when displaying an order list with customer names. Which fix is most appropriate?
-
A
Add an index on orders.customer_id
-
B
Use Order.includes(:customer) in the controller
-
C
Cache the customer names in a Redis store
-
D
Denormalize customer_name into the orders table