You are working with a large database of portfolios that sometimes have an associated image. Which statement best explains the purpose of includes(:image) in this code? @portfolios = Portfolio.includes(:image).limit(20) @portfolios.each do |portfolio| puts portfolio.image.caption end
1. It preloads the images files using asset pipeline.
2. It selects only portfolios that have an image attached.
3. It includes the number of associated images when determining how many records to return.
4.It will execute two database queries of 21 database queries.
Answer:4
Posted Date:-2022-09-17 04:45:31