aboutsummaryrefslogblamecommitdiffstats
path: root/activerecord/test/models/invoice.rb
blob: 4be5a001934e11d928fdf3c5f7847568d7c6e8ad (plain) (tree)
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