re-write active record query to PostgreSQL
I'm not sure about all your condition stuff but going on your textual description of the problem..


  Reason of writing this query, I have another table camera_shares which is related to cameras table with camera_id, I also want to get the count of camera_shares against a camera_id, How could that be possible to geth the similar results in PostgreSQL


You'll want something like this...

SELECT camera_id, count(*)
FROM cameras AS c
JOIN camera_shares AS cs
  USING (camera_id)
GROUP BY camera_id;