'Display the item with the largest value (rails)

There are two products:

[#<WarehousePosition id: 3719518, available_amount: 2, price_with_fee: 0.4968e4>, 
#<WarehousePosition id: 3731603, available_amount: 5, price_with_fee: 0.1159545e5 >]>

how can i display the object with the largest available amount on the page? (including price and other parameters)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source