Sha256: 06d7c2bb3e473fc14421c525f90695c6abeb292356fc69e34b415200687f3a51

Contents?: true

Size: 195 Bytes

Versions: 4

Compression:

Stored size: 195 Bytes

Contents

# frozen_string_literal: true

class Invoice < ActiveRecord::Base
  has_many :line_items, autosave: true
  before_save { |record| record.balance = record.line_items.map(&:amount).sum }
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ibm_db-5.5.0-x86-mingw32 test/models/invoice.rb
ibm_db-5.4.1-x86-mingw32 test/models/invoice.rb
ibm_db-5.4.0-x86-mingw32 test/models/invoice.rb
ibm_db-5.3.2-x86-mingw32 test/models/invoice.rb