Ruby on Rails nil can't be coerced into BigDecimal
Why do I get nil can't be coerced into BigDecimal when I try to perform a calculation: here's the code: model/drink.rb class Drink < ActiveRecord::Base belongs_to :menu before_save :total_amount def total_amount self.total_amount = self.price * self.quantity end model/menu.rb class Menu < ActiveRecord::Base has_many :drinks, :dependent => :destroy accepts_nested_attributes_for :drinks, :allow_destroy => true #Validations end * Drink is the (nested)child model and Menu the parent model When I attempt to create a new drink the browser display following error message nil can't be coerced into