Hey guys, I have a pretty much noob question here.
I’m having problems adding values that come from a database, for example if I have several orders in the database, and they have their amounts I can add them using something like
And you’re sure that item.amount has been initialized?
I would suggest using the script/console command to test this out… script/console opens up an IRB window that will allow you access to all of your models… you can do a find statement just like you would in your actual site
outstanding = 0
Bill.find_by_status_id(1).each do |bill|
puts outstanding, bill.amount
outstanding += bill.amount
end
And see what the values are when it errors (see if it thinks that outstanding is nil, or bill.amount)
If that works perfectly, then you are somehow un-initializing one of these values elsewhere in your application.