I am having a problem defining a method. I have this code in my buy model:
def update_amount newamount
self.total_amount = self.total_amount +newamount
end
and this code is in another place:
buy.update_amount(amount)
If I run the program, I get this error:
ArgumentError (wrong number of arguments (1 for 0)):
app/models/buy.rb:18:in `update_amount'
Now, if I change for this (just try):
buy.update_amount
I get this error:
ArgumentError (wrong number of arguments (0 for 1)):
app/models/buy.rb:18:in `update_amount'
I'm new to Ruby on Rails, so maybe this is easy.
source
share