File: invoice.rb

package info (click to toggle)
ruby-activerecord-2.3 2.3.14-6
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,180 kB
  • sloc: ruby: 32,874; makefile: 7
file content (4 lines) | stat: -rw-r--r-- 160 bytes parent folder | download | duplicates (4)
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