title: getting the count of another table values in existing query Rails
body: <p>Currently I am doing this to get data from my tables as</p>
  
  <pre><code>cameras = Camera.joins("left JOIN users on cameras.owner_id = users.id")
                  .joins("left JOIN vendor_models vm on cameras.model_id = vm.id")
                  .joins("left JOIN vendors v on vm.vendor_id = v.id")
                  .where(condition).order(sorting(col_for_order, order_for)).decorate
  </code></pre>
  
  <p>And this generates such query as </p>
  
  <pre><code>SELECT "cameras".* FROM "cameras" left JOIN users on cameras.owner_id = users.id left JOIN vendor_models vm on cameras.model_id = vm.id left JOIN vendors v on vm.vendor_id = v.id
  </code></pre>
  
  <p>I have an other table as <code>camera_shares</code> on which I have relation of camera's table as there is a <code>camera_id</code> which is present in <code>camera_shares</code> table as well, in each <code>camera_shares</code> there is an <code>camera_id</code> which tell us that the share is for which camera, I want to calculate the count of <code>camera_shares</code>, For example if there is a camera with id <code>12</code> and there are also 20 <code>camera_shares</code> with <code>camera_id</code> = <code>12</code> then I want to count the total of it. I want to do that in Rails query as I have shown above? How is that possible to do? </p>