I'm new to Ruby on Rails. I'm trying to determine the proper ruby query for the following SQL query.
Select max(bid_amount) from biddings where listing_id = 1;
I need to extract the maximum value in the bid_amount column. But it has to have a dynamic listing_id.
Try:
Update:
To follow up on your comment: since you say you are passing in
params[:id]
, it's best to convert that parameter to integer so that unwanted values don't go to the database. For e.g.