Rails заказ ноль последнее
Photo.order('collection_id DESC NULLS LAST') # NULLs come last
Wide-eyed Wolverine
Photo.order('collection_id DESC NULLS LAST') # NULLs come last