aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/invoice.rb
blob: 44ee7171875671c18197bc8a3c12f69f28c7cafc (plain) (blame)
1
2
3
4
class Invoice < ActiveRecord::Base
  has_many :line_items, autosave: true
  before_save {|record| record.balance = record.line_items.map(&:amount).sum }
end