Fixed primary_key_name for count query on a Model.