I’m trying to write a method to return true or false whether a product is actually in stock in a particular storage. I want to pass storage as parameter but receive an error through the console. What’s the right syntax?
def units_in_stock(storage)
storage_id = Storage.find_by_id(storage)
stocks.where("stock.storage_id = storage_id, in_stock > 0")
end
That should be:
You could also use
conditions.