Advertisement
Guest User

Product.joins(:options).where(options: { id: [7,8] })

a guest
Sep 12th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 2.57 KB | None | 0 0
  1. 2.3.0 :901 >   Product.joins(:options).WHERE(options: { id: [7,8] })
  2.   Product LOAD (77.8ms)  SELECT `products`.* FROM `products` INNER JOIN `options_products` ON `options_products`.`product_id` = `products`.`id` INNER JOIN `options` ON `options`.`id` = `options_products`.`option_id` WHERE `options`.`id` IN (7, 8)
  3.  => #<ActiveRecord::Relation [#<Product id: 122, subcategory_id: 16, life_cycle_id: nil, name: "product_2", photo: nil, short_desc: "", description: "", parameters: "", media: "", downl: "", meta_d: "dasd", meta_k: "dasdasd", active: TRUE, media_active: TRUE, downloads_active: TRUE, lang_id: 1, created_at: "2019-09-08 10:13:56", updated_at: "2019-09-08 10:57:51", gallery: "product_2", rank: 1, top_rated: TRUE, slug: "product_2", title_seo: "product_2", custom: false>, #<Product id: 122, subcategory_id: 16, life_cycle_id: nil, name: "product_2", photo: nil, short_desc: "", description: "", parameters: "", media: "", downl: "", meta_d: "dasd", meta_k: "dasdasd", active: TRUE, media_active: TRUE, downloads_active: TRUE, lang_id: 1, created_at: "2019-09-08 10:13:56", updated_at: "2019-09-08 10:57:51", gallery: "product_2", rank: 1, top_rated: TRUE, slug: "product_2", title_seo: "product_2", custom: false>, #<Product id: 123, subcategory_id: 16, life_cycle_id: nil, name: "product_3", photo: nil, short_desc: "", description: "", parameters: "", media: "", downl: "", meta_d: "", meta_k: "", active: TRUE, media_active: TRUE, downloads_active: TRUE, lang_id: 1, created_at: "2019-09-08 10:14:13", updated_at: "2019-09-08 10:57:58", gallery: "product_3", rank: 1, top_rated: FALSE, slug: "product_3", title_seo: "product_3", custom: false>, #<Product id: 124, subcategory_id: 16, life_cycle_id: nil, name: "product_1", photo: nil, short_desc: "<p>product_1</p>", description: "<p>product_1</p>", parameters: "", media: "", downl: "", meta_d: "product_1", meta_k: "product_1", active: TRUE, media_active: TRUE, downloads_active: TRUE, lang_id: 1, created_at: "2019-09-08 10:17:26", updated_at: "2019-09-08 10:17:26", gallery: "product_1", rank: 1, top_rated: FALSE, slug: "product_1", title_seo: "product_1", custom: true>, #<Product id: 124, subcategory_id: 16, life_cycle_id: nil, name: "product_1", photo: nil, short_desc: "<p>product_1</p>", description: "<p>product_1</p>", parameters: "", media: "", downl: "", meta_d: "product_1", meta_k: "product_1", active: TRUE, media_active: TRUE, downloads_active: TRUE, lang_id: 1, created_at: "2019-09-08 10:17:26", updated_at: "2019-09-08 10:17:26", gallery: "product_1", rank: 1, top_rated: FALSE, slug: "product_1", title_seo: "product_1", custom: true>]>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement