title: Query condition to HABTM association not working
body: <p>I want to make a query joining two models, Devices and Users in a HABTM association:</p>
  
  <pre><code>@device = Device.left_outer_joins(:users).where(users: {id: nil || 4})
  </code></pre>
  
  <p>I am trying to get any users that are <code>nil</code> in the join table or have the id <code>4</code>. The problem is that this query is ignoring the <code>nil</code> condition and generating this:</p>
  
  <pre><code>SELECT `devices`.* FROM `devices` LEFT OUTER JOIN `devices_users` ON `devices_users`.`device_id` = `devices`.`id` LEFT OUTER JOIN `users` ON `users`.`id` = `devices_users`.`user_id` WHERE `devices`.`serial` = '1111-1111-10' AND `users`.`id` = 4
  </code></pre>
  
  <p>What do I do to get this condition to be valid?</p>