or Blogs
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
Kiprosh is now part of LawLytics
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
Recently I faced one scenario with NULL value with NOT IN, I have added the details here about what I learnt. suppose we have two table Category and Product Category id | name -------- 1 | Category 1 2 | Category 2 3 | Category 3 4 | Category 4 Product id | name | category_id ----------------------------- 1 | Product 1 | 1 2 | Product 2 | 2 3 | Product 3 | 2 4 | Product 4 | 3 5 | Product 5 | 4 6 | Product 6 | NULL Scenario :- *I just want to retrieve all the Products excluding Category 1 and Category 3 so I wrote following query :- Product.joins(:category)